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

NextJS - Invalid Refresh Token #171

Closed
ARMATAV opened this issue Jul 12, 2022 · 11 comments · Fixed by #296
Closed

NextJS - Invalid Refresh Token #171

ARMATAV opened this issue Jul 12, 2022 · 11 comments · Fixed by #296
Labels
nextjs Next.js specific functionality question Further information is requested

Comments

@ARMATAV
Copy link

ARMATAV commented Jul 12, 2022

On the latest release, using purely the example in examples/nextjs, after the exp time elapses, I'm getting the following error.

image

How can I make sure that the automatic token refresh fires off properly?

(Local development via supabase start and its associated container(s))

@ARMATAV
Copy link
Author

ARMATAV commented Jul 12, 2022

Scratch that, this is with any and every example using NextJS and Supabase, with or without auth-helper. Very weird behavior.

@codewriter73
Copy link

@ARMATAV Do you know if there has been any updates about this?

@ARMATAV
Copy link
Author

ARMATAV commented Jul 16, 2022

@ARMATAV Do you know if there has been any updates about this?

None so far - just a bunch of closed issues surrounding it; perhaps they deprioritized in favor of something else.

@krtkeyan
Copy link

Facing a similar issue where the users get signed out after the expiry time, upon debugging seems the refresh token fails with the Invalid Refresh token in logger.

@travispamaral
Copy link

This seems to be in a recent update. Im lowered my auth-helpers-nextjs to 0.2.1 from 0.2.5 and this worked as expected

@krtkeyan
Copy link

krtkeyan commented Aug 9, 2022

Tried downgrading to 0.2.1, and even though I didn't get Invalid Refresh Token error message, still the token doesn't get refreshed and it logs JWT expired

@Bladeyy
Copy link

Bladeyy commented Aug 10, 2022

Any solution to this yet?

@mrolafsson
Copy link

mrolafsson commented Aug 11, 2022

I'm guessing does not work with supabase-js@next (1.36.0-next.17)?

@ARMATAV
Copy link
Author

ARMATAV commented Aug 16, 2022

https://supabase.com/blog/supabase-js-v2

This solves the “getting logged out” issue, which has been a recurring challenge in our GitHub Discussions.

Should be good to go here now, right?

@tourbillonlabs
Copy link

tourbillonlabs commented Sep 3, 2022

I've seen @thorwebdev reference #92 as resolving this issue but it still seems to be present.

I'm using supabaseServerClient on an unsecured /api endpoint, and every now and then I get the error JWT expired unless I hit a client-side route which refreshes the token.

I've tried with @latest and @rc of supabase-js and related packages:

"@supabase/auth-helpers-nextjs": "^0.2.7",
"@supabase/auth-helpers-shared": "^0.1.3",
"@supabase/supabase-js": "^2.0.0-rc.8",

Edit: Updated package versions to reflect latest attempt state.

@thorwebdev
Copy link
Member

The next release should make this more robust. You can already try it out with installing npm install @supabase/auth-helpers-nextjs@next and you can find the migration guide here: https://github.com/supabase/auth-helpers/blob/next/packages/nextjs/MIGRATION_GUIDE.md#migrating-to-03x

@thorwebdev thorwebdev reopened this Sep 28, 2022
@thorwebdev thorwebdev added question Further information is requested nextjs Next.js specific functionality labels Sep 28, 2022
This was linked to pull requests Nov 4, 2022
This was unlinked from pull requests Nov 4, 2022
@thorwebdev thorwebdev linked a pull request Nov 4, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nextjs Next.js specific functionality question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants