M
M
Max Bozhenov2015-11-25 22:52:38
JavaScript
Max Bozhenov, 2015-11-25 22:52:38

How to make Vkontakte OAuth and Angular.js friends?

Good day,

I implement authorization with VK OAuth through the client, on the angular.js client

Here is the request for authorization and getting "code"
$http.jsonp(' https://oauth.vk.com/authorize ', {
method: 'GET ',
params: {
client_id: SocialConfigs.vkontakte.apiId,
display: 'popup',
redirect_uri: ' localhost:3000 ',
scope: 'email',
response_type: 'code',
v: '5.40',
callback: 'handleVkontakteLogin'
}
});

After the redirect, a request and a response with the necessary "code" appear in the networks, this code is in the GET parameter as it should be (but not in the address bar and the router does not process it), the entire HTML code of the page also comes in response, which conflicts and stops the site, displaying an error: Uncaught SyntaxError: Unexpected token <

The error points to the HTML code that came in the Response, how to get rid of this? Maybe someone already has?
I don’t do it through the SDK, because I need to pull the email from the user.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pesenka1, 2015-11-26
@pesenka1

Dig into these sources.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question