diff --git a/providers/google/session.go b/providers/google/session.go index f2791df59..0206dfa5a 100644 --- a/providers/google/session.go +++ b/providers/google/session.go @@ -41,7 +41,9 @@ func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, s.AccessToken = token.AccessToken s.RefreshToken = token.RefreshToken s.ExpiresAt = token.Expiry - s.IDToken = token.Extra("id_token").(string) + if idToken := token.Extra("id_token"); idToken != nil { + s.IDToken = idToken.(string) + } return token.AccessToken, err } diff --git a/providers/openidConnect/session.go b/providers/openidConnect/session.go index b5d38f22b..84b577c39 100644 --- a/providers/openidConnect/session.go +++ b/providers/openidConnect/session.go @@ -57,7 +57,9 @@ func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, s.AccessToken = token.AccessToken s.RefreshToken = token.RefreshToken s.ExpiresAt = token.Expiry - s.IDToken = token.Extra("id_token").(string) + if idToken := token.Extra("id_token"); idToken != nil { + s.IDToken = idToken.(string) + } return token.AccessToken, err }