Skip to content
Snippets Groups Projects
Commit 5be47317 authored by Cornel Rautenbach's avatar Cornel Rautenbach
Browse files

ExtractAppleEmailFromIDToken

parent f6e27167
No related branches found
Tags v1.265.0
Loading
...@@ -71,3 +71,19 @@ func ValidateAppleCode(code, redirectURI, encryptionKeySecret string, isDebug bo ...@@ -71,3 +71,19 @@ func ValidateAppleCode(code, redirectURI, encryptionKeySecret string, isDebug bo
return string_utils.InterfaceToString(email) return string_utils.InterfaceToString(email)
} }
func ExtractAppleEmailFromIDToken(idToken string) (string, error) {
claim, err := apple.GetClaims(idToken)
if err != nil {
return "", err
}
email := (*claim)["email"]
emailVerified := (*claim)["email_verified"]
if emailVerified != true {
return "", errors.Error("email not verified")
}
return string_utils.InterfaceToString(email)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment