Next.js Authentication Tutorial

Hey there, @timojokinen.

You can easily fetch an access token for an API by configuring the audience property on the Passport Auth0 strategy. I built a sample to show that: fetching access token for a different API/audience; by brunokrebs · Pull Request #1 · auth0-blog/nextjs-passport · GitHub

Note, however, that it is not a good idea to let the token leak to the browser. Use it on the backend only and fetch the API from there. That’s why I use delete user.accessToken.

I hope that helps.