Skip to content

Commit 66f7af9

Browse files
timinationtrimination
timination
andauthored
Hotfix instagram api (#6922)
* updated defaultURL to allow new insta API access * updated defaultURL to allow new insta API access * updates tests for new instagram API url Co-authored-by: Tim Talbot <[email protected]>
1 parent 922dc76 commit 66f7af9

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

spec/AuthenticationAdapters.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ describe('AuthenticationProviders', function () {
6666
});
6767

6868
it(`should provide the right responses for adapter ${providerName}`, async () => {
69-
const noResponse = ['twitter', 'apple', 'gcenter', "google", 'keycloak'];
69+
const noResponse = ['twitter', 'apple', 'gcenter', 'google', 'keycloak'];
7070
if (noResponse.includes(providerName)) {
7171
return;
7272
}
@@ -527,7 +527,7 @@ describe('instagram auth adapter', () => {
527527
{}
528528
);
529529
expect(httpsRequest.get).toHaveBeenCalledWith(
530-
'https://api.instagram.com/v1/users/self/?access_token=the_token'
530+
'https://graph.instagram.com/me?fields=id&access_token=the_token'
531531
);
532532
});
533533

@@ -544,7 +544,7 @@ describe('instagram auth adapter', () => {
544544
{}
545545
);
546546
expect(httpsRequest.get).toHaveBeenCalledWith(
547-
'https://new-api.instagram.com/v1/users/self/?access_token=the_token'
547+
'https://new-api.instagram.com/v1/me?fields=id&access_token=the_token'
548548
);
549549
});
550550
});

src/Adapters/Auth/instagram.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// Helper functions for accessing the instagram API.
22
var Parse = require('parse/node').Parse;
33
const httpsRequest = require('./httpsRequest');
4-
const defaultURL = 'https://api.instagram.com/v1/';
4+
const defaultURL = 'https://graph.instagram.com/';
55

6-
// Returns a promise that fulfills iff this user id is valid.
6+
// Returns a promise that fulfills if this user id is valid.
77
function validateAuthData(authData) {
88
const apiURL = authData.apiURL || defaultURL;
9-
const path = `${apiURL}users/self/?access_token=${authData.access_token}`;
9+
const path = `${apiURL}me?fields=id&access_token=${authData.access_token}`;
1010
return httpsRequest.get(path).then(response => {
1111
if (response && response.data && response.data.id == authData.id) {
1212
return;

0 commit comments

Comments
 (0)