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

Ability to pass a custom continueUrl throught the password reset flow #84

Open
henrymunro opened this issue Apr 11, 2023 · 0 comments
Open

Comments

@henrymunro
Copy link

What I want to achieve

I'd like to add functionallity to my application so that non-authenticated users that attempt to hit privileged pages will be redirected to sign in, then after signing in/resetting their password they'll be redirected back to the page they previously attempted to hit.

Doing this requires maintinaing some state during all the authentication flows so I know where to send the users back to after they have completed.

What I've got so far

I've been able to do this for:

  • sign in with email + password (all handled in my app)
  • sign in with google (I sent the url to redirect back to via the context in signInWithProvider and I am able to get it back from the return value in handleSignInRedirect)

Where I'm having issues

I've not been able to do this for the reset password flow. Ideally the flow would be:

  1. Unauthenticated user hits /privilidged-page/1
  2. Redirected to /sign-in?redirectTo=%2Fprivilidged-page%2F1
  3. User clicks reset password and inputs their email, we then call sendOobCode('PASSWORD_RESET', email)
  4. User follows link in reset password flow
  5. User completes reset password flow and is redirect to /privilidged-page/1

Is there a way for me to pass state between 3, 4 and 5? Ideally I'd be able to pass some context to sendOobCode, like we can to signInWithProvider.

I can see in sendOobCode that currently a continueUrl is sent. The firebase docs state can be used for my purpose, but it looks like it's being leveraged for another purpose in this library (magic link sign in, I think):

continueUrl: this.redirectUri + `?email=${email}`

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

1 participant