Auth0's Single Page App vs. Auth0's Next.js Integration

1 replies
Last updated: Mar 20, 2021
I'm also thinking of using Auth0 to authenticate the users, in Auth0, they have something for single page app (react application) and something that's for Traditional applications. My sanity.io template uses NextJS which is also a react application, do I chose the Auth0's Single Page App integration (for React) or Auth0's NextJS integration ? I'm a bit lost here
Mar 20, 2021, 9:53 AM
I'm using this for firebase auth in a next app now
https://www.npmjs.com/package/next-firebase-auth Turns out is in a beta and I am an idiot for using it, but I did ask for some help on the nextjs discord chats and many people recommended NextAuth.js

https://next-auth.js.org/
It features integration with Auth0 and is made for nextjs

NextAuth.js docs tells us
"Configure your application in Auth0 as a 'Regular Web Application' (not a 'Single Page App')."
https://next-auth.js.org/providers/auth0
I assume that you can configure it to be SPA, but then I think you loose most of the server side functionality for the nextjs app logged inn pages

If you are using the nextjs-auth+ package you should also set it as a regular app
"Create a Regular Web Application in the 
Auth0 Dashboard  and configure the following URLs for your application under Application URIs:" - https://auth0.com/blog/introducing-the-auth0-next-js-sdk/
if you are gong to do everything client side and have no need for anything server side you can use the SPA option and the auth0-react package.
Mar 20, 2021, 10:18 AM

Sanity.io – build remarkable experiences at scale

Sanity is a customizable solution that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Categorized in