What language/framework are you using? Typically you would implement your own authentication for learning the nuts and bolts of auth, but never for a production/live system on the web.
You would either use something like Firebase Auth or the built-in one that comes with your framework of choice. Identity in .NET core for example.
On the topic of auth, and as an aside, wondering if anyone has used a UUID + API key combination to do auth instead of JWT/cookies?