Skip to content

Conversation

@frederikprijck
Copy link
Contributor

@frederikprijck frederikprijck commented Mar 27, 2025

This PR updates the sample application to use v4 of the @auth0/nextjs-auth0 SDK.

The most significant change is that the authentication is handled by the middleware now, and we no longer have things such as withApiAuthRequired and withPageAuthRequired.

Additionally, we introduce a lib/auth0 file, which we use to call things such as getSession() and getAccessToken().

Let's first merge #181, then I will rebase this branch to simplify the diff.

@frederikprijck frederikprijck changed the title Chore/bump auth0 Update nextjs-auth0 to v4 Mar 27, 2025
@frederikprijck frederikprijck force-pushed the chore/bump-auth0 branch 3 times, most recently from f3e43e6 to 6f1a9bf Compare March 27, 2025 09:33
Comment on lines +13 to +14
scope: "openid profile email read:shows",
audience: process.env.AUTH0_AUDIENCE,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems quite strange that for one of these fields we are hardocding and for the other we are reading from env. Can we make this consistent? IMO since SDK does not read process.env.AUTH0_AUDIENCE automatically, this should be made apparent to the user. If there are plans to restore this behaviour, the same can be changed later.

Copy link
Contributor Author

@frederikprijck frederikprijck Mar 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think environment variables are solely useful when the SDK picks them up automatically.

I will make that clear by adding a comment that the SDK no longer picks up AUTH0_AUDIENCE automatically, ansd that we need to pass it in here. I will also bring back process.env.AUTH0_SCOPE.

@frederikprijck
Copy link
Contributor Author

Replacing by #186

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants