B
B
Boris Yakushev2016-08-24 17:41:21
Yii
Boris Yakushev, 2016-08-24 17:41:21

How to work most effectively with the social API. networks for registering and entering the site?

Good afternoon.
Tell me please.
I use yii2-authclient for registration on the site and subsequent authentication.
There are several questions:
1. What is the best way to check the social. networks? because for every social networks in the array contains
$attributes = $client->getUserAttributes();
different data and I think to write if or switch directly in the controller to determine which social network. the network the user is currently using is not the best idea.
2. What to do if the social. the network does not give email? For example, in VK, the user may not be linked to the email page. If I understood correctly, then twitter does not give the user's email at all.

Twitter doesn't allow the user's email to be returned, but you have to work with that somehow.

Opt out of mandatory email? What then to do with password recovery, for example, if the user does not specify an email during normal registration?
Thanks everyone for the advice.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Nikita, 2016-08-24
@za4me

1. Redefine default clients to suit your needs.
2. If soap is required, put a layer - check for the presence of soap and redirect all requests to the page with a request to enter soap.

A
Anatoly, 2016-08-24
@taliban

Each social network has a unique identifier, and be attached to it. A password is not needed at all, because the user logs in via oauth through a third-party resource, and you essentially receive an answer, yes logged in, no not logged in. This is a normal situation, resources that make it possible to log in through a third-party site and then take an email from there and create a local account do this not entirely correctly.

M
Maxim Timofeev, 2016-08-26
@webinar

As an option - do not bother and connect, for example, via ulogin ( https://ulogin.ru):
then when registering a user, you will receive standardized data regardless of the social network and always receive email.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question