Repository navigation
feat(auth): list the identities linked to the signed-in user - #606
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Callers can list the external identities linked to the signed-in user with a dedicated method. The data comes from the server, so identities linked or unlinked since sign-in show up, which the cached
User.Identitiescannot guarantee.Capability:
auth.identities.list_identities— List Identities. (No capability spec; contract from the GoTrue OpenAPIGET /user.)Public API
New types: none (reuses
UserIdentity).Behavior
GET /userwithAuthorization: Bearer <current session access token>and the client'sapikey.GotrueException(Reason = Offline); no session or no access token →GotrueException(Reason = NoSessionFound), with no request sent.identitiesarray of the returned user, in server order. Anullidentities field or anulluser body → empty list (never null).GotrueExceptionthrough the existing error mapping (e.g. an expired token → 403error_code = bad_jwt).gotrue.get_user_identitiesdomain span parents the HTTP span.Deviations from supabase-js
{ data: { identities }, error }. This returns the list and throws the typedGotrueException(v8 error model).getUser()→getSession(), which refreshes an expired session first. This uses the current access token as is, consistent withLinkIdentity/UnlinkIdentity, and leaves refreshing to the background auto-refresh.Tests
Identities/UserIdentitiesTestsemailidentity for that userIdentities/UserIdentitiesContractTestsGET /userwith bearer + apikey; identities mapped in order from the server (not the cached user); null identities / null body → empty;bad_jwtrejection;NoSessionFound(no session, no access token, nothing sent);Offline; cancellation; no deadlock on a blocking synchronization contextObservability/ObservabilityContractTestsGET /userHTTP spanChanged-line coverage: 100% (33 lines). Mutation: 6/6 tested mutants on changed lines detected (5 killed, 1 timeout on
ConfigureAwait(true)), 0 survivors.Notes
[PartialCapability]removed fromUser.Identities;[ImplementedCapability]now sits onClient.GetUserIdentitiesAsync.GotrueInstrumentation.cschanged from tabs to spaces because touching it pulls it into the changed-file format check;git diff -wshows only the one added span constant.IGotrueClient<TUser, TSession>breaks only third-party implementers of the interface, so it gets no migration-guide entry.bad_jwtstill maps toFailureHint.Reason.AdminTokenRequired(existing mapping, unchanged here), which reads oddly for a user token. A possible follow-up.