retrieve user email address via the GitHub user email API when logging in with GitHub

This commit is contained in:
MaysWind
2025-10-24 01:45:16 +08:00
parent 85b05f9e7e
commit beea6fe733
7 changed files with 193 additions and 82 deletions
@@ -36,7 +36,7 @@ type CommonOAuth2DataSource interface {
GetScopes() []string
// ParseUserInfo returns the user info by parsing the response body
ParseUserInfo(c core.Context, body []byte) (*data.OAuth2UserInfo, error)
ParseUserInfo(c core.Context, body []byte, oauth2Client *http.Client) (*data.OAuth2UserInfo, error)
}
// GetOAuth2AuthUrl returns the authentication url of the common OAuth 2.0 provider
@@ -76,7 +76,7 @@ func (p *CommonOAuth2Provider) GetUserInfo(c core.Context, oauth2Token *oauth2.T
return nil, errs.ErrFailedToRequestRemoteApi
}
return p.dataSource.ParseUserInfo(c, body)
return p.dataSource.ParseUserInfo(c, body, oauth2Client)
}
// GetDataSource returns the data source of the common OAuth 2.0 provider