Closed pesty closed 7 months ago
I have same issue
@kmjennison pls help us,
This issue provides a recommended solution:
The document / sample code should be updated to include a / before auth-ssr so that it will pass the login request to the right script.
const destURL = new URL(destPath, origin) return `/auth-ssr?destination=${encodeURIComponent(destURL)}`
A PR is welcome!
Describe the bug
The sample config to demonstrate the dynamic destination URL when redirecting from app pages can lead to infinite redirection.
Specifically, this is the config:
For example, when accessing http://localhost:3000/reviews/1234, it will redirect to:
The document / sample code should be updated to include a
/
before auth-ssr so that it will pass the login request to the right script.Versions
next-firebase-auth
version: 1.0.0-canary.18 Firebase JS SDK: 9.14.0 Next.js: 13.0.6To Reproduce Steps to reproduce the behavior:
pages/reviews
. Create apages/reviews/[id].js
and use withAuthUserTokenSSR for SSR.pages/reviews/index.js
and use withAuthUserTokenSSR to compare./reviews
and/reviews/1234
without logged in./reviews
should work fine, but/reviews/1234
will lead to infinite redirection.Expected behavior Both should be able to redirect the to /auth-ssr correctly, with the destination set to the encoded original url.
Debug and error logs Please update README.md & initAuth.js in the sample code.