gladly-team / next-firebase-auth

Simple Firebase authentication for all Next.js rendering strategies
https://nfa-example-git-v1x-gladly-team.vercel.app/
MIT License
1.34k stars 291 forks source link

Firebase JavaScript SDK 9.17.0 - 9.17.1 - Client side redirect not working. #612

Closed tombouquet closed 1 year ago

tombouquet commented 1 year ago

When filing a bug report, please confirm you've done the following:

  1. Have you set onVerifyTokenError and onTokenRefreshError in your config and checked for any helpful errors?

Yes

  1. Have you set debug: true in your config and read through server-side and client-side debug logs for any helpful messages?

Yes

  1. Have you tried the example app with your own Firebase credentials?

Yes

  1. Have you read through the troubleshooting Q&A?

Yes

Describe the bug

Just a heads up that these versions do not work when using client side redirecting after a user has signed in. No errors in the console, debug or anything. Version 9.17.0 does have a bug which is why it isn't working however it is fixed in 9.17.1, which is where the bug I am describing is occuring. I've just included it as an fyi for anyone.

I understand that devs can't always keep up with all the new versions of stuff. I just spent a long time trying to figure out why my app isn't working and didn't want anyone else to suffer the pain. 😊

Versions

next-firebase-auth version: canary.18 Firebase JS SDK: 9.17.0 - 9.17.1 Next.js: 13.1.6

To Reproduce Steps to reproduce the behavior:

  1. Make a sign in page (i've been using signInWithPopUp).
  2. Add withAuthUser with the whenAuthed option to redirect to the app.
  3. Login.
  4. Done. The AuthUser var will not update. But if you add an onIdTokenChange func you can see that it actually does.

Expected behavior When the user logs in the page redirects.

kmjennison commented 1 year ago

Thanks for the issue. Could you clarify: do you believe this is a bug in next-firebase-auth or just a bug in Firebase? Does this occur with older versions of the Firebase JS SDK?

zerefati commented 1 year ago

I am experiencing the same issue where upon logging in, the system displays a message indicating successful login, but fails to redirect to the designated application page URL until a manual refresh is performed.

kmjennison commented 1 year ago

Closing this until there's more info or a reproduction. FYI: any error could also be related to #614 .