H
H
HoHsi2015-11-29 06:06:37
In contact with
HoHsi, 2015-11-29 06:06:37

How to make authorization on the site through VK?

Good morning!
I am doing authorization on the site through VK, and I encountered such a moment. Authorization is possible in two ways:
1) Force the user to go to VK using the link, and redirect back. After that, check the code with which the user redirected through the server by sending a request to the VK API from the site.
2) Connect the JS VK lib, and redirect the user to it so that it returns expire, mid, secret, sid, sig. Then check sig through the server.
The first case is bad because you have to make a request to another site through the server (yes, for Node.js this is not a problem, but still). + perhaps this is an anonymus of the brain, but it confuses me to send requests from my site to VK, with an explicit indication of secret in the get request.
The second - you need to connect a separate js lib, and this is always not pleasant.
What is the best way to choose?
PS If the guys from the VK development department are sitting here, you should know that your documentation is written with a heel, it contains a lot of outdated information, discrepancies in different docks for the same method, undocumented functions, errors in variable naming, and frequent jambs in the answers themselves.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nicholas, 2015-11-29
@ACCNCC

What is the best way to choose? =>>> Which one is closer to the soul))))
In general, I did it through the server (your first option) and there were no problems with it!

V
vladimir_avshtolis, 2017-04-07
@vladimir_avshtolis

Found this discussion, interesting
1st way "Forcing the user to go to the VK by the link, and redirect back" - do you also need to force the redirect back? That is, in VK he should see something like "click here to go back"? And if he sees something else interesting there on the right or left and forgets about you?
2. What I actually wanted to ask - I put the second method on the site - a button with the call onclick="VK.Auth.login(authInfo);"
on the phone, a person is usually authorized in VK on a mobile client, and not in a browser. And pressing this button leads exactly to the browser, to a window with a proposal to enter the name and password from VK into it. This is very inconvenient, how to get around this - so as not to force the user to enter any passwords anywhere?
Is there a way 3?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question