feat(gotrue): Implement linkIdentityWithIdToken
method
#1206
+74
−23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Feature - This PR adds a new linkIdentityWithIdToken method to the GoTrue client for linking identities using ID tokens, and refactors the existing signInWithIdToken method to share common code.
What is the current behavior?
Currently, users can only sign in with ID tokens using the signInWithIdToken method, but there's no way to link additional identities to an existing user account using ID tokens. The signInWithIdToken and any potential identity linking methods would have duplicate code.
What is the new behavior?
Key Features:
Additional context
This implementation follows the same pattern as the existing signInWithIdToken method but adds the link_identity flag for identity linking functionality. The refactoring improves code maintainability by eliminating duplication while preserving all existing functionality.
The changes are minimal and focused, affecting only the GoTrue client authentication methods without any breaking changes to the public API.
Reference PR: supabase/auth-js#1096
Close #1111
Close #1200