commit
						a7c5d9c478
					
				|  | @ -67,7 +67,7 @@ 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 := jwtDecodeSegment(jwt[1]) | 	b, err := base64.RawURLEncoding.DecodeString(jwt[1]) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return "", err | 		return "", err | ||||||
| 	} | 	} | ||||||
|  | @ -89,14 +89,6 @@ func emailFromIdToken(idToken string) (string, error) { | ||||||
| 	return email.Email, nil | 	return email.Email, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func jwtDecodeSegment(seg string) ([]byte, error) { |  | ||||||
| 	if l := len(seg) % 4; l > 0 { |  | ||||||
| 		seg += strings.Repeat("=", 4-l) |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return base64.URLEncoding.DecodeString(seg) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (p *GoogleProvider) Redeem(redirectURL, code string) (s *SessionState, err error) { | func (p *GoogleProvider) Redeem(redirectURL, code string) (s *SessionState, err error) { | ||||||
| 	if code == "" { | 	if code == "" { | ||||||
| 		err = errors.New("missing code") | 		err = errors.New("missing code") | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue