Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Instagram scope #492

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 8 additions & 19 deletions providers/instagram/instagram.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it still instagram.com for the API endpoints? From docs it looks like these have been updated to facebook.com

I'm looking at https://developers.facebook.com/docs/instagram-api/getting-started

)

// New creates a new Instagram provider, and sets up important connection details.
Expand Down Expand Up @@ -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
}
Expand All @@ -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 {
Expand Down