
Authenticate Users with Auth0 in Next.js
Draft
1 November, 2021
Contributors

What is Auth0?
Setup
Cleanup
Start using Next auth
api
folder in pages called auth
.Setting up an application in Auth0
•
Sign up to Auth0
•
Go to applications under the applications tab

•
Create a new application
•
Select Regular Web Applications and give a name to your app, then click on create.

client id
, and the client secret
and add it to your .env.local file.Creating a sign-in button


getServerSideProps
where we will get our user details via session.Showing the user details
Deployment
•
Sign up with your GitHub
•
Click on create a new project
•
Import the repository that you created
•
Click deploy
•
After the site is deployed go to the dashboard of the current app click on settings and then Environment Variables.
•
Add the Auth0 client id, Auth0 client secret, and Auth0 domain which is present in our .env.local file.
•
After you add the two it will look like this.

•
We will add another variable, our Next Auth URL and it will be the deployed URL instead of the localhost.
•
To get the URL, click on domains, get the shortest link, and add it to the NEXTAUTH_URL variable. It would be similar to https://next-auth0-demo.vercel.app/

•

•

Change the URI in Auth0
