T
T
TAnonim2019-05-26 23:11:02
Laravel
TAnonim, 2019-05-26 23:11:02

How should authentication be arranged in a Laravel + Vue SPA application?

Greetings! I want to figure out how authentication should take place in a Vue SPA application in conjunction with Laravel. I want to sign in to the application only through the social. network, there is no login / password.
How to get a social token The network is in principle clear:
1. The user clicks on the login button, a pop-up window opens with the site of the corresponding social network. networks.
2. The user confirms access to the application, redirects back to our site /oauth/{provider}/callback, after which the pop-up window closes.
3. Social Token network received by the spa application.
How to make requests to your API now? I want to use Laravel Passport to authenticate against my API. What to do next with a social token networks? What token should I use to make requests to my API?
I read about automatic authentication of API requests from an application on the front, but I don’t know how this can be implemented in my case, it’s not specifically clear how the first request should occur, after which a cookie will be created.
Thanks in advance for advice and help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Wells, 2019-05-27
@Alex_Wells

Use either Socialite + socialiteproviders. When redirecting, they will give you the user of the desired social. networks. Do whatever you want with this data, you can either write down the ID or throw it away. Then everything is as usual, with or without a passport.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question