Skip to content

Commit

Permalink
[Enhancement] Add EmailVerified field for Apple's ID token
Browse files Browse the repository at this point in the history
  • Loading branch information
althenlimzixuan committed May 17, 2024
1 parent eb002ea commit 16133e9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions providers/apple/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type ID struct {
Sub string `json:"sub"`
Email string `json:"email"`
IsPrivateEmail bool `json:"is_private_email"`
EmailVerified bool `json:"email_verified"`
}

type Session struct {
Expand Down Expand Up @@ -52,6 +53,7 @@ type IDTokenClaims struct {
AuthTime int `json:"auth_time"`
Email string `json:"email"`
IsPrivateEmail BoolString `json:"is_private_email"`
EmailVerified BoolString `json:"email_verified,omitempty"`
}

func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
Expand Down Expand Up @@ -124,6 +126,7 @@ func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string,
Sub: idToken.Claims.(*IDTokenClaims).Subject,
Email: idToken.Claims.(*IDTokenClaims).Email,
IsPrivateEmail: idToken.Claims.(*IDTokenClaims).IsPrivateEmail.Value(),
EmailVerified: idToken.Claims.(*IDTokenClaims).EmailVerified.Value(),
}
}

Expand Down

0 comments on commit 16133e9

Please sign in to comment.