Skip to content
This repository was archived by the owner on Jan 24, 2019. It is now read-only.

Commit 542ef54

Browse files
authored
Strip JWT base64 padding before parsing. #560
1 parent ae49c7d commit 542ef54

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

providers/google.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ func emailFromIdToken(idToken string) (string, error) {
6767
// id_token is a base64 encode ID token payload
6868
// https://developers.google.com/accounts/docs/OAuth2Login#obtainuserinfo
6969
jwt := strings.Split(idToken, ".")
70-
b, err := base64.RawURLEncoding.DecodeString(jwt[1])
70+
jwtData := strings.TrimSuffix(jwt[1], "=")
71+
b, err := base64.RawURLEncoding.DecodeString(jwtData)
7172
if err != nil {
7273
return "", err
7374
}

0 commit comments

Comments
 (0)