Answer the question
In order to leave comments, you need to log in
How to properly build oauth registration logic?
Good afternoon!
I register through social networks. I can't figure out how to build a proper script with redirects.
For example, let's take VK.
Required data from the user: first name, last name, email, phone. It would be cool to authorize without reloading the page (via Open API), but then you can’t get an email (do I understand correctly?).
Social phone number networks do not give, so we will request it additionally, after successful authorization through the social network.
Step 1: show the window
Step 2: When you click the VK icon, redirect the browser to:
http://oauth.vk.com/authorize?client_id=XXX&redirect_uri=http://mysite.ru/oauth.php&response_type=code&display=popup&scope=email
Answer the question
In order to leave comments, you need to log in
Click on the button to open the link in a new window
All redirects are made in this window and then your page is returned in which your javascript will be
var vk = window.opener.document.getElementById('vklogin');
vk.fnOnVkAuth(email);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question