Its also important to understand the flow of authentication. Take this website for example
You are currently viewing this website in your browser. When someone on this forum post a reply, a request is made to codecademy server (to store tge reply). The server needs to know as which user you are logged in. So a piece of information (lets call it a token) is send along with the request, so the back-end knows who you are.
so when you logged into this website/forum, a piece of information (cookie) was stored on your computer.
Retrieving the user from the database, is only a small part of authentication. You might want to follow along with the course till you get there. Otherwise the amount of information might be overwhelming