Strip JWT base64 padding before parsing. #560
This commit is contained in:
parent
ae49c7d23c
commit
542ef54093
@ -67,7 +67,8 @@ func emailFromIdToken(idToken string) (string, error) {
|
|||||||
// id_token is a base64 encode ID token payload
|
// id_token is a base64 encode ID token payload
|
||||||
// https://developers.google.com/accounts/docs/OAuth2Login#obtainuserinfo
|
// https://developers.google.com/accounts/docs/OAuth2Login#obtainuserinfo
|
||||||
jwt := strings.Split(idToken, ".")
|
jwt := strings.Split(idToken, ".")
|
||||||
b, err := base64.RawURLEncoding.DecodeString(jwt[1])
|
jwtData := strings.TrimSuffix(jwt[1], "=")
|
||||||
|
b, err := base64.RawURLEncoding.DecodeString(jwtData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user