Skip to content

Commit 8a71006

Browse files
authored
feat: support transfer_sub in apple id tokens (#2162)
Gain access to the [`transfer_sub` claim present in Apple ID tokens](https://developer.apple.com/documentation/signinwithapple/bringing-new-apps-and-users-into-your-team) when an app is being transferred from one owner to another (e.g. when an app is purchased by another company).
1 parent 746c937 commit 8a71006

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/api/provider/oidc.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ type AppleIDTokenClaims struct {
170170

171171
AuthTime *float64 `json:"auth_time"`
172172
IsPrivateEmail *IsPrivateEmail `json:"is_private_email"`
173+
174+
TransferSub string `json:"transfer_sub"`
173175
}
174176

175177
func parseAppleIDToken(token *oidc.IDToken) (*oidc.IDToken, *UserProvidedData, error) {
@@ -201,6 +203,10 @@ func parseAppleIDToken(token *oidc.IDToken) (*oidc.IDToken, *UserProvidedData, e
201203
data.Metadata.CustomClaims["auth_time"] = *claims.AuthTime
202204
}
203205

206+
if claims.TransferSub != "" {
207+
data.Metadata.CustomClaims["transfer_sub"] = claims.TransferSub
208+
}
209+
204210
if len(data.Metadata.CustomClaims) < 1 {
205211
data.Metadata.CustomClaims = nil
206212
}

0 commit comments

Comments
 (0)