How to make a custom login/signup UI with Next.js? (not using universal flow)

I want to make a custom login flow but store users and authenticate with Auth0 in my Next.js app. I’ve seen the nextjs-auth0 npm package but it seems that’s only for the Universal Login (nextjs-auth0 doesn't work with auth0 lock · Issue #141 · auth0/nextjs-auth0 · GitHub)

Is this correct? If so, is there another way to achieve this? Maybe working with the authentication api directly? Thanks!

Hey there!

Basically it doesn’t matter what stack you’re using. If you want to build the UI of your app yourself and add authentication to it you will need to use endpoints from our Authentication API:

https://auth0.com/docs/api/authentication

1 Like

Thanks. Is there anything I need to do beyond just calling the signup and login endpoints? I.e. for login I assume I would need to cache the access_token or something like that? Do you know of a good tutorial for this? Thanks for your help and response!!

Hi @rahulrentash

Actually, building your own UI/login flow is very complex and we do not recommend doing it. When you do this, you take on all the security risks in your application, instead of passing them off to Auth0.

The Universal Login Page/Auth Code or Auth Code + PKCE is the best way to go.

John

1 Like