feat(token): support link_identity in the token-exchange grant#2614
Closed
spydon wants to merge 1 commit into
Closed
feat(token): support link_identity in the token-exchange grant#2614spydon wants to merge 1 commit into
spydon wants to merge 1 commit into
Conversation
spydon
force-pushed
the
feat/facebook-access-token-grant
branch
from
July 3, 2026 08:08
5dc0147 to
1d3f849
Compare
spydon
force-pushed
the
feat/facebook-access-token-grant-link-identity
branch
from
July 3, 2026 08:08
a844510 to
44bc577
Compare
spydon
force-pushed
the
feat/facebook-access-token-grant
branch
from
July 3, 2026 08:39
1d3f849 to
16f15c6
Compare
spydon
force-pushed
the
feat/facebook-access-token-grant-link-identity
branch
2 times, most recently
from
July 3, 2026 08:42
e3d5fbe to
1d63179
Compare
spydon
force-pushed
the
feat/facebook-access-token-grant
branch
from
July 3, 2026 09:17
16f15c6 to
39ea58a
Compare
spydon
force-pushed
the
feat/facebook-access-token-grant-link-identity
branch
from
July 3, 2026 09:18
1d63179 to
f709746
Compare
spydon
force-pushed
the
feat/facebook-access-token-grant
branch
2 times, most recently
from
July 6, 2026 09:42
9b63794 to
f1c4695
Compare
spydon
force-pushed
the
feat/facebook-access-token-grant-link-identity
branch
from
July 6, 2026 09:44
f709746 to
0a12d3d
Compare
spydon
force-pushed
the
feat/facebook-access-token-grant
branch
from
July 6, 2026 10:01
f1c4695 to
0280c58
Compare
spydon
force-pushed
the
feat/facebook-access-token-grant-link-identity
branch
from
July 6, 2026 10:03
0a12d3d to
7b762bd
Compare
spydon
force-pushed
the
feat/facebook-access-token-grant
branch
from
July 6, 2026 11:54
0280c58 to
bbeefc9
Compare
spydon
force-pushed
the
feat/facebook-access-token-grant-link-identity
branch
from
July 6, 2026 11:56
7b762bd to
ef29762
Compare
spydon
force-pushed
the
feat/facebook-access-token-grant
branch
from
July 7, 2026 19:57
05f0a39 to
abaae77
Compare
spydon
force-pushed
the
feat/facebook-access-token-grant-link-identity
branch
from
July 7, 2026 19:57
a0037f9 to
537c06a
Compare
spydon
force-pushed
the
feat/facebook-access-token-grant
branch
from
July 8, 2026 07:32
abaae77 to
835be4e
Compare
spydon
force-pushed
the
feat/facebook-access-token-grant-link-identity
branch
from
July 8, 2026 07:35
537c06a to
527af6b
Compare
spydon
force-pushed
the
feat/facebook-access-token-grant
branch
from
July 14, 2026 07:50
835be4e to
d97b05b
Compare
When link_identity is set and a valid user access token is provided in the Authorization header, link the provider identity to that user instead of signing in an existing identity. The provider subject comes from the verified access token; no profile claims are needed. Banned users are rejected on this path too.
spydon
force-pushed
the
feat/facebook-access-token-grant-link-identity
branch
from
July 14, 2026 08:23
527af6b to
aee6aec
Compare
Contributor
Author
|
Closing this since it wouldn't work for users that aren't logged in. |
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.
What
Adds
link_identitysupport to the token-exchange grant (#2609), so an already-authenticated user can attach a provider identity using a provider access token.Why
Parity with the
id_tokengrant, which already supportslink_identity. Lets a user who signed in another way connect their Facebook account natively (no browser). Because it only needs the verified provider subject, it works even when the app is already authorized (the token is a classic access token with no id token), which is the common case.How
link_identityis set, require a valid user access token in theAuthorizationheader (requireAuthentication), resolve the target user, and reject the request if that user is banned (requireAuthenticationitself does not check bans).linkIdentityToUser(using the verified subject) instead of the sign-in-existing lookup. No profile claims are needed, only the subject fromdebug_token.Limitations
linkIdentityToUserrequires an email to confirm and the Facebook access token carries none. Those users should link via the existing web flow (LinkIdentity, which fetches the profile via/me).identity_datais sparse (only the subject), unlike the web flow which stores the full profile (email/name/avatar).Tests
TestTokenExchangeLinkIdentity: links Facebook to an existing signed-in user; asserts the same user is returned and thefacebookidentity is attached.TestTokenExchangeLinkIdentityRequiresAuth: linking without anAuthorizationheader is rejected.TestTokenExchangeLinkIdentityRejectsBannedUser: a banned user cannot link (and thus cannot re-establish a session).Stacking
Stacked on #2609 (base branch
feat/facebook-access-token-grant). Review/merge that first; this diff is only the linking addition.