Skip to content

Commit

Permalink
Fix provider crash when userinfo email is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
c2thorn committed Nov 16, 2022
1 parent 3649500 commit 121b51c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/6839.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
provider: fixed a crash during provider authentication for certain environments
```
3 changes: 3 additions & 0 deletions google/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,9 @@ func GetCurrentUserEmail(config *Config, userAgent string) (string, error) {
if err != nil {
return "", fmt.Errorf("error retrieving userinfo for your provider credentials. have you enabled the 'https://www.googleapis.com/auth/userinfo.email' scope? error: %s", err)
}
if res["email"] == nil {
return "", fmt.Errorf("error retrieving email from userinfo. email was nil in the response.")
}
return res["email"].(string), nil
}

Expand Down

0 comments on commit 121b51c

Please sign in to comment.