diff --git a/providers/instagram/instagram.go b/providers/instagram/instagram.go index b4703dc44..1d8aaa574 100644 --- a/providers/instagram/instagram.go +++ b/providers/instagram/instagram.go @@ -19,7 +19,7 @@ import ( var ( authURL = "https://api.instagram.com/oauth/authorize/" tokenURL = "https://api.instagram.com/oauth/access_token" - endPointProfile = "https://api.instagram.com/v1/users/self/" + endPointProfile = "https://graph.instagram.com/v15.0/me" ) // New creates a new Instagram provider, and sets up important connection details. @@ -110,22 +110,10 @@ func (p *Provider) FetchUser(session goth.Session) (goth.User, error) { } func userFromReader(reader io.Reader, user *goth.User) error { - u := struct { - Data struct { - ID string `json:"id"` - UserName string `json:"username"` - FullName string `json:"full_name"` - ProfilePicture string `json:"profile_picture"` - Bio string `json:"bio"` - Website string `json:"website"` - Counts struct { - Media int `json:"media"` - Follows int `json:"follows"` - FollowedBy int `json:"followed_by"` - } `json:"counts"` - } `json:"data"` - }{} - err := json.NewDecoder(reader).Decode(&u) + var u struct { + ID string `json:"id"` + UserName string `json:"username"` + } err := json.NewDecoder(reader).Decode(&u) if err != nil { return err } @@ -147,11 +135,12 @@ func newConfig(p *Provider, scopes []string) *oauth2.Config { TokenURL: tokenURL, }, Scopes: []string{ - "basic", + "user_profile", }, } defaultScopes := map[string]struct{}{ - "basic": {}, + "user_profile": {}, + "user_media": {}, } for _, scope := range scopes {