fixed vkontakte validateAuthData (#4977)

* fixed vkontakte validateAuthData

* updated changelog
This commit is contained in:
eddyLazar
2018-08-17 22:38:07 +03:00
committed by Florent Vilmart
parent f771160147
commit 41acaa0570
3 changed files with 5 additions and 3 deletions

View File

@@ -2,6 +2,8 @@
### master
[Full Changelog](https://github.com/parse-community/parse-server/compare/3.0.0...master)
#### Bug fixes:
* Fixes issue with vkontatke authentication
### 3.0.0

View File

@@ -7,7 +7,7 @@ const responses = {
instagram: { data: { id: 'userId' } },
janrainengage: { stat: 'ok', profile: { identifier: 'userId' }},
janraincapture: { stat: 'ok', result: 'userId' },
vkontakte: { response: { user_id: 'userId'}},
vkontakte: { response: [{ id: 'userId'}]},
google: { sub: 'userId' },
wechat: { errcode: 0 },
weibo: { uid: 'userId' },

View File

@@ -10,8 +10,8 @@ var logger = require('../../logger').default;
function validateAuthData(authData, params) {
return vkOAuth2Request(params).then(function (response) {
if (response && response.access_token) {
return request("api.vk.com", "method/secure.checkToken?token=" + authData.access_token + "&client_secret=" + params.appSecret + "&access_token=" + response.access_token + "&v=5.59").then(function (response) {
if (response && response.response && response.response.user_id == authData.id) {
return request("api.vk.com", "method/users.get?access_token=" + authData.access_token + "&v=5.8").then(function (response) {
if (response && response.response && response.response.length && response.response[0].id == authData.id) {
return;
}
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Vk auth is invalid for this user.');