Skip to content

Commit

Permalink
Fix provider crash when userinfo email is nil (#6839) (#13056)
Browse files Browse the repository at this point in the history
Fixes #13051

Signed-off-by: Modular Magician <magic-modules@google.com>

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician committed Nov 16, 2022
1 parent f43c146 commit 615abbf
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
@@ -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
Expand Up @@ -519,6 +519,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 615abbf

Please sign in to comment.