yii2-usuario
yii2-usuario copied to clipboard
Custom scenarios (Question)
Hello! I need to implement a third-pary service login and registration via API. Is there a way to add new custom scenario? Or i even dont need it?
How it would work:
I have login and registration form on frontend.
The data from this form is sending to API.
If login creds are correct then API sends me an information about the user - its account number and some additional info, but it doesnt returns me an email and i dont need to operate with it, same as with password. Same situation with the registration - i can register with email or with phone but not both.
And now i cant understand how to make it better with this module. I can use account number as username, and even can make some fake-email with an username and some @domain.com .
But i have some questions. Maybe i can make it by overriding modules classes, like adding a new scenario and new AuthClient as with the social network. I havent found it in documentation. Thats not an issue - just a question for advice. Thank you !
I'm not a big expert, but maybe the AuthClient approach is the best and cleanest. You delegate auth to an external entity and just use it in Usuario.
I'll leave the issue open for others to comment.
Thank you @maxxer for reply!