D
D
Daniil Myasnikov2021-09-18 21:26:25
OAuth
Daniil Myasnikov, 2021-09-18 21:26:25

How to properly implement authorization through social networks paired with laravel-passport?

I can’t understand exactly how to implement authorization through social networks paired with laravel-passport? I found laravel socialite in the laravel documentation, after that, through the external authorization service, I get access and refresh tokens of the service through which I authorized. In Google, people wrote their custom grants for a passport and through them they already received tokens for their site, but something tells me that this is such an option. What is the best way to implement this type of authorization?

The idea came to me to make my own callback, to which tokens of a third-party service would be sent from the client, and then my site would send a request to an external service, but it sounds somehow crazy ... with each secure request to my resource, check the user through an external service (google etc.)... or is it still correct? Totally confused)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin B., 2021-09-18
@m9snikfeed

Login through social networks is done once. This process is simple, you go to the address of your site that redirects you to the selected service (for example, VK), there you press enter and you are redirected to the callback url of your service with a tokenon (one-time) by which you can get user data, you (socialite) sends a request to get the user only once, not each. You are already working with the received data, for example, create a user if it does not exist and log in on your backend

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question