Answer the question
In order to leave comments, you need to log in
Social authentication network what to do?
Good morning!
For training, I decided to write a class for authentication through social networks. networks.
I figured out oauth, api too.
There was a following question:
For example on a site there is a registered user with mail [email protected]
After some time, this user decides to log in using the social. networks, say vk.com.
O presses the button, we carry out all the actions and get data from vk.
{
id: 1,
first_name: "Name",
last_name: "Last",
email: "[email protected]"
}
Answer the question
In order to leave comments, you need to log in
There is an important point here: some social networks do not give access to soap (for example, VK). Yes, and there may be a situation when there are different soaps on the social network and on the site, but the user is the same. It is better to explicitly ask for an e-mail (or better, a password too) after authorization from the provider, but if the provider has provided an e-mail, then simply substitute it in the appropriate field in the form. If you are trying to use an existing soap, then give an error and suggest first logging in, and then linking an account in your personal account (like in Habré).
Well, in the database, store provider-UID pairs either directly in the user's field, or in a separate table.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question