[#405] updated Google OAuth2 userinfo response data
This commit is contained in:
parent
a0d7f23d77
commit
96d09a30c4
|
@ -29,12 +29,11 @@ func NewGoogleProvider() *Google {
|
||||||
|
|
||||||
// FetchAuthUser returns an AuthUser instance based the Google's user api.
|
// FetchAuthUser returns an AuthUser instance based the Google's user api.
|
||||||
func (p *Google) FetchAuthUser(token *oauth2.Token) (*AuthUser, error) {
|
func (p *Google) FetchAuthUser(token *oauth2.Token) (*AuthUser, error) {
|
||||||
// https://cloud.google.com/identity-platform/docs/reference/rest/v1/UserInfo
|
|
||||||
rawData := struct {
|
rawData := struct {
|
||||||
LocalId string `json:"localId"`
|
Id string `json:"id"`
|
||||||
DisplayName string `json:"displayName"`
|
Name string `json:"name"`
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
PhotoUrl string `json:"photoUrl"`
|
Picture string `json:"picture"`
|
||||||
}{}
|
}{}
|
||||||
|
|
||||||
if err := p.FetchRawUserData(token, &rawData); err != nil {
|
if err := p.FetchRawUserData(token, &rawData); err != nil {
|
||||||
|
@ -42,10 +41,10 @@ func (p *Google) FetchAuthUser(token *oauth2.Token) (*AuthUser, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
user := &AuthUser{
|
user := &AuthUser{
|
||||||
Id: rawData.LocalId,
|
Id: rawData.Id,
|
||||||
Name: rawData.DisplayName,
|
Name: rawData.Name,
|
||||||
Email: rawData.Email,
|
Email: rawData.Email,
|
||||||
AvatarUrl: rawData.PhotoUrl,
|
AvatarUrl: rawData.Picture,
|
||||||
}
|
}
|
||||||
|
|
||||||
return user, nil
|
return user, nil
|
||||||
|
|
Loading…
Reference in New Issue