diff --git a/providers/github.go b/providers/github.go index 26526ce76..09c899753 100644 --- a/providers/github.go +++ b/providers/github.go @@ -197,8 +197,8 @@ func (p *GitHubProvider) hasOrgAndTeam(accessToken string) (bool, error) { func (p *GitHubProvider) GetEmailAddress(s *SessionState) (string, error) { var emails []struct { - Email string `json:"email"` - Primary bool `json:"primary"` + Email string `json:"email"` + Verified bool `json:"verified"` } // if we require an Org or Team, check that first @@ -243,7 +243,7 @@ func (p *GitHubProvider) GetEmailAddress(s *SessionState) (string, error) { } for _, email := range emails { - if email.Primary { + if email.Verified { return email.Email, nil } } diff --git a/providers/github_test.go b/providers/github_test.go index 481018258..a59af5246 100644 --- a/providers/github_test.go +++ b/providers/github_test.go @@ -98,7 +98,7 @@ func TestGitHubProviderOverrides(t *testing.T) { } func TestGitHubProviderGetEmailAddress(t *testing.T) { - b := testGitHubBackend([]string{`[ {"email": "michael.bland@gsa.gov", "primary": true} ]`}) + b := testGitHubBackend([]string{`[ {"email": "michael.bland@gsa.gov", "verified": true} ]`}) defer b.Close() bURL, _ := url.Parse(b.URL) @@ -112,8 +112,8 @@ func TestGitHubProviderGetEmailAddress(t *testing.T) { func TestGitHubProviderGetEmailAddressWithOrg(t *testing.T) { b := testGitHubBackend([]string{ - `[ {"email": "michael.bland@gsa.gov", "primary": true, "login":"testorg"} ]`, - `[ {"email": "michael.bland1@gsa.gov", "primary": true, "login":"testorg1"} ]`, + `[ {"email": "michael.bland@gsa.gov", "verified": true, "login":"testorg"} ]`, + `[ {"email": "michael.bland1@gsa.gov", "verified": true, "login":"testorg1"} ]`, `[ ]`, }) defer b.Close()