Skip to content

Commit

Permalink
fix: fail gracefully when id_token is missing
Browse files Browse the repository at this point in the history
fixes #551 and #530
  • Loading branch information
Func86 committed Jun 22, 2024
1 parent 260588e commit a57015c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion providers/google/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
4 changes: 3 additions & 1 deletion providers/openidConnect/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit a57015c

Please sign in to comment.