Attempt to use simpler avatar url property.
This commit is contained in:
parent
1e8940c65d
commit
82b6bc8cfd
1 changed files with 6 additions and 11 deletions
|
@ -125,17 +125,12 @@ func (p *Provider) FetchUser(session goth.Session) (goth.User, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func userFromReader(reader io.Reader, user *goth.User) error {
|
func userFromReader(reader io.Reader, user *goth.User) error {
|
||||||
type FlashiiUserAvatarRes struct {
|
|
||||||
Resolution int32 `json:"res"`
|
|
||||||
URL string `json:"url"`
|
|
||||||
}
|
|
||||||
|
|
||||||
u := struct {
|
u := struct {
|
||||||
Id string `json:"id"`
|
Id string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
AvatarURLs []FlashiiUserAvatarRes `json:"avatar_urls"`
|
AvatarURL string `json:"avatar_url"`
|
||||||
}{}
|
}{}
|
||||||
|
|
||||||
err := json.NewDecoder(reader).Decode(&u)
|
err := json.NewDecoder(reader).Decode(&u)
|
||||||
|
@ -147,7 +142,7 @@ func userFromReader(reader io.Reader, user *goth.User) error {
|
||||||
user.NickName = u.Name
|
user.NickName = u.Name
|
||||||
user.Email = u.Email
|
user.Email = u.Email
|
||||||
user.Description = u.Title
|
user.Description = u.Title
|
||||||
user.AvatarURL = u.AvatarURLs[0].URL
|
user.AvatarURL = u.AvatarURL
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue