Fix for authenticating with instagram (#7173)

* Fix for authenticating with instagram

* Change tests for instagram authentication

* Instagram authentication for the case when data child object is presented in the response
This commit is contained in:
OverDrive
2021-02-19 20:19:13 +01:00
committed by GitHub
parent c05102b90c
commit a1cd631425
2 changed files with 12 additions and 3 deletions

View File

@@ -8,7 +8,8 @@ function validateAuthData(authData) {
const apiURL = authData.apiURL || defaultURL;
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) {
const user = response.data ? response.data : response
if (user && user.id == authData.id) {
return;
}
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Instagram auth is invalid for this user.');