Nextjs-auth0 question RE "/api/auth/me"

Hi everyone,

I am using “nextjs-auth0” package and I am quite happy with it however I have one question that’s bugging me. I was going through the package’s source code but I need to make sure of the following:

When the application starts the route “/api/auth/me” checks if the user is authenticated and it returns user data and obviosult if the user is not authenticated this route will return “not_authenticated”. My question is: does it always hits the auth-server when “/api/auth/me” is being hit.

Thanks a lot.

@auth0/nextjs-auth0: ^1.6.1
“next”: “11.1.2”,

Hi @contact13 , welcome to the community!

I’m not an expert on the nextjs SDK source code, so I did some testing with the nextjs quickstart, and I couldn’t see traffic hitting the Auth0 servers when /api/auth/me is hit. Instead, this appears to use a session cache on your app’s side.

If the HandleProfile handler was given the refetch option, based on these docs, this would hit the /userinfo endpoint to update the session however.

I hope that helps!