Skip to content

Hotfix instagram api #6922

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

Merged
merged 3 commits into from
Oct 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions spec/AuthenticationAdapters.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('AuthenticationProviders', function () {
});

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

Expand All @@ -544,7 +544,7 @@ describe('instagram auth adapter', () => {
{}
);
expect(httpsRequest.get).toHaveBeenCalledWith(
'https://new-api.instagram.com/v1/users/self/?access_token=the_token'
'https://new-api.instagram.com/v1/me?fields=id&access_token=the_token'
);
});
});
Expand Down
6 changes: 3 additions & 3 deletions src/Adapters/Auth/instagram.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Helper functions for accessing the instagram API.
var Parse = require('parse/node').Parse;
const httpsRequest = require('./httpsRequest');
const defaultURL = 'https://api.instagram.com/v1/';
const defaultURL = 'https://graph.instagram.com/';

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