From 91193c77eb947ad3b23ec4918e1f84035598a4a9 Mon Sep 17 00:00:00 2001 From: Denis Trofimov Date: Mon, 26 Jun 2017 19:33:08 +0700 Subject: [PATCH] fix(vkontakte auth adapter): replace deadlocked promise with a live one (#3956) --- src/Adapters/Auth/vkontakte.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Adapters/Auth/vkontakte.js b/src/Adapters/Auth/vkontakte.js index 4e57b259..7a445566 100644 --- a/src/Adapters/Auth/vkontakte.js +++ b/src/Adapters/Auth/vkontakte.js @@ -23,14 +23,15 @@ function validateAuthData(authData, params) { } function vkOAuth2Request(params) { - var promise = new Parse.Promise(); - return promise.then(function(){ + return new Promise(function (resolve) { if (!params || !params.appIds || !params.appIds.length || !params.appSecret || !params.appSecret.length) { logger.error('Vk Auth', 'Vk auth is not configured. Missing appIds or appSecret.'); throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Vk auth is not configured. Missing appIds or appSecret.'); } - return request("oauth.vk.com", "access_token?client_id=" + params.appIds + "&client_secret=" + params.appSecret + "&v=5.59&grant_type=client_credentials") - }) + resolve(); + }).then(function () { + return request("oauth.vk.com", "access_token?client_id=" + params.appIds + "&client_secret=" + params.appSecret + "&v=5.59&grant_type=client_credentials"); + }); } // Returns a promise that fulfills iff this app id is valid.