Nextjs-auth0: Documentation Example

Hi,

Hopefully this is the right place to ask the following questions.
I am building a site with Nextjs (and currently not using TypeScript). I have a Login button that I want to redirect to the Auth0 login page, like the example page on the documentation for the nextjs-auth0 library.

I don’t really understand the setup for this example, but (and correct me if I’m wrong) it appears as if the example is more complex than the documentation describes. For example, each of the three examples (/api-call-example, /basic-example, and /sample-api) in the /examples directory appear to be required for the entire [page] (https://nextjs-auth0-api-example.now.sh/) to work.

To clarify, want I want to achieve: I want my Login button on my Header to redirect to the Auth0 login page (just like the nextjs-auth0 example page), have the user be able to log in and see a Profile button (that displays some data of the user — also as in the example page) and Logout button.

Right now, I am just trying to get the /basic-example to work and have the following JS files, like in the directory (ignore auth0_myEdits.js):

Upon running npm run dev, I get an infinite loop of the page trying to load and wind up with a .json error report file. Not sure what I am doing wrong but I believe it may have something to do with my auth0.js or config.js file (perhaps entering my actual clientId, clientSecret, domain, etc.? but I am unsure how this is conveyed in the code provided in the example directory??)

Any help would be greatly appreciated!

I will try reformatting the /basic-example to using TypeScript, removing the config.js file, and solely using the auth0.js file with my appropriate app info and seeing if that works. If that doesn’t work, should I get in touch with support?

Thanks again!

1 Like

Hey there!

In this case I recommend working on it directly with the repo maintainer. Can you raise a GitHub issue in the repo: GitHub - auth0/nextjs-auth0: Next.js SDK for signing in with Auth0 providing the same context that you provided here and then share the link with us so we can ping the repo maintainer? Thank you!

1 Like

Hi!

Appreciate your quick response.

I have made a Github issue on the repo here and provided essentially the same context.

Thank you again very much for your help!

1 Like

Perfect! I just pinged repo maintainer regarding that!

1 Like

This topic was automatically closed after 10 days. New replies are no longer allowed.