Skip to content

Commit de8545c

Browse files
committed
fix: accept ID tokens from all .apple.com issuers
1 parent 1365aaa commit de8545c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

internal/api/provider/apple.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ import (
1313
"golang.org/x/oauth2"
1414
)
1515

16-
const IssuerApple = "https://appleid.apple.com"
16+
func IsIssuerApple(issuer string) bool {
17+
return issuer == "https://appleid.apple.com" || (strings.HasPrefix(issuer, "https://") && strings.HasSuffix(issuer, ".apple.com"))
18+
}
1719

1820
// AppleProvider stores the custom config for apple provider
1921
type AppleProvider struct {

internal/api/provider/oidc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ func ParseIDToken(ctx context.Context, provider *oidc.Provider, config *oidc.Con
5555
switch token.Issuer {
5656
case IssuerGoogle:
5757
token, data, err = parseGoogleIDToken(token)
58-
case IssuerApple:
59-
token, data, err = parseAppleIDToken(token)
6058
case IssuerLinkedin:
6159
token, data, err = parseLinkedinIDToken(token)
6260
case IssuerKakao:
@@ -66,6 +64,8 @@ func ParseIDToken(ctx context.Context, provider *oidc.Provider, config *oidc.Con
6664
default:
6765
if IsAzureIssuer(token.Issuer) {
6866
token, data, err = parseAzureIDToken(token)
67+
} else if IsAppleIssuer(token.Issuer) {
68+
token, data, err = parseAppleIDToken(token)
6969
} else {
7070
token, data, err = parseGenericIDToken(token)
7171
}

0 commit comments

Comments
 (0)