Skip to content

Commit 6f35820

Browse files
authored
Merge pull request #251 from pnmcosta/master
Explicit Instagram session support to use different graph url
2 parents 38d95ed + 49ccd51 commit 6f35820

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

session.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ var (
4141
"graph": "https://graph.facebook.com/",
4242
"graph_video": "https://graph-video.facebook.com/",
4343
"www": "https://www.facebook.com/",
44+
"instagram": "https://graph.instagram.com/",
4445
}
4546

4647
// checks whether it's a video post.
@@ -54,6 +55,7 @@ type Session struct {
5455
Version string // facebook versioning.
5556
RFC3339Timestamps bool // set to true to send date_format=Y-m-d\TH:i:sP on every request which will cause RFC3339 style timestamps to be returned
5657
BaseURL string // set to override API base URL - trailing slash is required, e.g. http://127.0.0.1:53453/
58+
Instagram bool // set the session explicity to Instagram, see https://developers.facebook.com/docs/instagram-platform/instagram-api-with-instagram-login/migration-guide#step-2--update-your-code
5759

5860
accessToken string // facebook access token. can be empty.
5961
app *App
@@ -608,6 +610,9 @@ func (session *Session) getURL(name, path string, params Params) string {
608610
baseURL := domainMap[name]
609611
if session.BaseURL != "" {
610612
baseURL = session.BaseURL
613+
} else if session.Instagram && name == "graph" {
614+
// see https://developers.facebook.com/docs/instagram-platform/instagram-api-with-instagram-login/migration-guide#step-2--update-your-code
615+
baseURL = domainMap["instagram"]
611616
}
612617
buf.WriteString(baseURL)
613618

0 commit comments

Comments
 (0)