You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In development, it seems like there's a race condition with auth somewhere. I'm constantly redirected back to my login page with useAuthenticatedBlitzContext or getting AuthenticationErrors (with resolver.authorize, for example).
After refreshing multiple times, it works.
siddhsuresh: Ah @merlindru, I remember having and fixing a race condition while creating this hook.
Do you have two useAuthenticatedBlitzContext, one having redirectAuthenticated and one having redirect ?
Merlin: Kind of, I have this:
Login Page --> Home Page (if authenticated)
All other pages (including Home Page) --> Login Page (if logged out)
But
Even if I remove them, I get an AuthenticationError on queries/mutations with resolver.authorize
So it's not the hook that's at fault
Usually it works if I refresh 2-3 times
Paste all your error logs here:
AuthenticationError when using resolver.authorize, redirect loop (sometimes 50+ redirects!) using the setup outlined above
error - node_modules/@blitzjs/rpc/dist/index-server.cjs (79:12) @ $authorize
error - AuthenticationError: You must be logged in to access this
at Generator.next (<anonymous>)
What is the problem?
From a conversation between @siddhsuresh and I:
In development, it seems like there's a race condition with auth somewhere. I'm constantly redirected back to my login page with useAuthenticatedBlitzContext or getting AuthenticationErrors (with resolver.authorize, for example).
After refreshing multiple times, it works.
Paste all your error logs here:
AuthenticationError when using
resolver.authorize
, redirect loop (sometimes 50+ redirects!) using the setup outlined abovePaste all relevant code snippets here:
n/a
What are detailed steps to reproduce this?
n/a
Run
blitz -v
and paste the output here:Please include below any other applicable logs and screenshots that show your problem:
No response
The text was updated successfully, but these errors were encountered: