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

fix: return error early for redirects #992

Merged
merged 2 commits into from
Dec 12, 2024

Conversation

kangmingtay
Copy link
Member

What kind of change does this PR introduce?

  • When using the PKCE flow, if there's a redirect error after the callback and a code is not returned, getSessionFromUrl ends up returning Not a valid PKCE flow url. instead of the actual error

@kangmingtay kangmingtay force-pushed the km/fix-identity-linking-error branch from ab7630f to 59df040 Compare December 12, 2024 08:04
@kangmingtay kangmingtay merged commit 9f32d30 into master Dec 12, 2024
3 checks passed
@kangmingtay kangmingtay deleted the km/fix-identity-linking-error branch December 12, 2024 09:04
@ChuckJonas
Copy link

@kangmingtay just wanted to make sure you are aware this change causes the JWT to be nuked from local storage every time the client is loaded (when there is no session in the URL).

#1334

hf added a commit that referenced this pull request Dec 13, 2024
This reverts commit 089c687.
hf added a commit that referenced this pull request Dec 13, 2024
Issues found with previous code:
#995
hf pushed a commit that referenced this pull request Dec 13, 2024
🤖 I have created a release *beep* *boop*
---


##
[2.67.1](v2.67.0...v2.67.1)
(2024-12-13)


### Bug Fixes

* revert [#992](#992) and
[#993](#993)
([#999](#999))
([12b2848](12b2848))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
kangmingtay added a commit that referenced this pull request Dec 16, 2024
kangmingtay added a commit that referenced this pull request Dec 17, 2024
## What kind of change does this PR introduce?
* Fixes the bug introduced previously in
https://github.com/supabase/auth-js/pull/993/files#diff-3522461172efd6058d6b8da62fc2d30d8b524d2b64894ea2c67218c52f7fdff5R310,
where it attempted to always try to find a session in the URL, which led
to users being logged out on a page refresh
* This PR also reverts the previous PR #992, which returns the error
early if there's a redirect, since some redirect errors (like identity
linking) should not result in the existing session being removed.
* Tested the following scenarios:
  * Sign in and refresh the page
  * Sign in and attempt to link an already existing identity
  * Sign in and attempt to link a new identity
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

Successfully merging this pull request may close these issues.

3 participants