fixed vkontakte validateAuthData (#4977)
* fixed vkontakte validateAuthData * updated changelog
This commit is contained in:
committed by
Florent Vilmart
parent
f771160147
commit
41acaa0570
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
### master
|
### master
|
||||||
[Full Changelog](https://github.com/parse-community/parse-server/compare/3.0.0...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
|
### 3.0.0
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const responses = {
|
|||||||
instagram: { data: { id: 'userId' } },
|
instagram: { data: { id: 'userId' } },
|
||||||
janrainengage: { stat: 'ok', profile: { identifier: 'userId' }},
|
janrainengage: { stat: 'ok', profile: { identifier: 'userId' }},
|
||||||
janraincapture: { stat: 'ok', result: 'userId' },
|
janraincapture: { stat: 'ok', result: 'userId' },
|
||||||
vkontakte: { response: { user_id: 'userId'}},
|
vkontakte: { response: [{ id: 'userId'}]},
|
||||||
google: { sub: 'userId' },
|
google: { sub: 'userId' },
|
||||||
wechat: { errcode: 0 },
|
wechat: { errcode: 0 },
|
||||||
weibo: { uid: 'userId' },
|
weibo: { uid: 'userId' },
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ var logger = require('../../logger').default;
|
|||||||
function validateAuthData(authData, params) {
|
function validateAuthData(authData, params) {
|
||||||
return vkOAuth2Request(params).then(function (response) {
|
return vkOAuth2Request(params).then(function (response) {
|
||||||
if (response && response.access_token) {
|
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) {
|
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.user_id == authData.id) {
|
if (response && response.response && response.response.length && response.response[0].id == authData.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Vk auth is invalid for this user.');
|
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Vk auth is invalid for this user.');
|
||||||
|
|||||||
Reference in New Issue
Block a user