Skip to content

Commit

Permalink
Fix provider crash when userinfo email is nil (GoogleCloudPlatform#6839)
Browse files Browse the repository at this point in the history
  • Loading branch information
c2thorn authored and googlerjk committed Nov 25, 2022
1 parent f6098ac commit 8d37e5b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mmv1/third_party/terraform/utils/utils.go
Original file line number Diff line number Diff line change
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 8d37e5b

Please sign in to comment.