Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Auth0 methods on a Server Action causes a flickering on the NextJS Client #1645

Open
6 tasks done
julianv97 opened this issue Jan 24, 2024 · 2 comments
Open
6 tasks done

Comments

@julianv97
Copy link

julianv97 commented Jan 24, 2024

Checklist

Description

We want to call a third party API through a server on a use client component and we need to send the Auth0 access token to that API.

When we call to getSession() or getAccessToken() inside that server action all the client have a flickering since the entire document along with the CSS and the fonts we use are reloaded again. If we don't use anything from Auth0 on that server action we don't have that flickering

Screen.Recording.2024-01-24.at.00.09.39.mov

Reproduction

  1. Create a use cliente component.
  2. Create a server action.
  3. Add logic to retrieve the Auth0 access token on the server action.
  4. Call to the server action on the use client component.
  5. There is the flickering and all the files reloaded.

Additional context

No response

nextjs-auth0 version

3.5.0

Next.js version

14.0.4

Node.js version

18.x

@novascreen
Copy link

novascreen commented Feb 1, 2024

I'm seeing the same, if i remove the auth0 code the response from the server action is tiny, with the auth0 code it returns a much larger response. almost looks like it's returning the entire page.
The flickering probably happens because the css is downloaded and applied again.

@julianv97 julianv97 changed the title Using Auth0 methods on a Server Action causes a flickering on the NextJS Cliente Using Auth0 methods on a Server Action causes a flickering on the NextJS Client Feb 6, 2024
@vanwalj
Copy link

vanwalj commented May 9, 2024

Same issue here, I digged a bit and it is caused by Next.js invalidating path whenever a cookie is set, which auth0 basically do whenever you call getSession I guess to refresh the session cookie

Next.js related issue here: vercel/next.js#50163

On my side it's making our form unusable as it is, forces us to us API/fetch instead of actions and will probably make me pull out of Auth0 in the long run :(

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

No branches or pull requests

3 participants