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: remove phone mfa deletion, match on error codes #963

Merged
merged 2 commits into from
Sep 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions src/GoTrueClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,8 @@
if (error) {
this._debug('#_initialize()', 'error detecting session from URL', error)

// hacky workaround to keep the existing session if there's an error returned from identity linking
// TODO: once error codes are ready, we should match against it instead of the message
if (

Check failure on line 316 in src/GoTrueClient.ts

View workflow job for this annotation

GitHub Actions / Test / OS ubuntu-latest / Node 18

Cannot find name 'identity_already_exists'.

Check failure on line 316 in src/GoTrueClient.ts

View workflow job for this annotation

GitHub Actions / Test / OS ubuntu-latest / Node 20

Cannot find name 'identity_already_exists'.
error?.message === 'Identity is already linked' ||
error?.message === 'Identity is already linked to another user'
error?.code === identity_already_exists
Copy link
Contributor Author

@J0 J0 Sep 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J0 marked this conversation as resolved.
Show resolved Hide resolved
) {
return { error }
}
Expand Down Expand Up @@ -2388,11 +2385,6 @@
return { data: null, error }
}

// TODO: Remove once: https://github.com/supabase/auth/pull/1717 is deployed
if (params.factorType === 'phone') {
Copy link
Contributor Author

@J0 J0 Sep 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TOTP object should now be null since v2.158.1 is deployed (we are now on v2.160.0)

To verify this go to Settings > Infrastructure

delete data.totp
}

if (params.factorType === 'totp' && data?.totp?.qr_code) {
data.totp.qr_code = `data:image/svg+xml;utf-8,${data.totp.qr_code}`
}
Expand Down
Loading