Hi @jkirkby91 -- mind if I query your solution to this one, if you found one? I am in exactly the same train of thought and would be interested to know what you found out.
yea, me too. would be great to know if someone found a solution.
Maybe the authentication flow from Satellizer can help you - Satellizer is an Angular plugin for email and social authentication: https://github.com/sahat/satellizer#-login-with-oauth-20
There is also a plugin for vue (vue-authenticate) which I suppose is doing basically the same: https://github.com/dgrubelic/vue-authenticate
I am currently working on integrating a Vue-SPA authentication with Laravel as backend with email und social authentication. That's why I am also interested in this topic. Have you in the meanwhile found a solution? thanks for your insights.
You need to look at the social authentication in a different way.
In the SPA use a package, like Hello.js or vue-authenticate to retrieve an access_token from one of your providers. Be sure that you're using the implicit auth flow.
Once you have retrieved an access token, you can send it to your API in exchange for an access_token to the API (Passport, JWT ect)
Your logic will be slightly different as you do not need to redirect the user from your API. Instead you could have a route like so:
Which implements the following:
$user = Socialite::driver($provider)->userFromToken($request->get('access_token')); // Implement logic to create/retrieve existing user // Implement logic to return a token (JWT, Passport)
Does that make sense?
Sign in to participate in this thread!
We'd like to thank these amazing companies for supporting us
The Laravel portal for problem solving, knowledge sharing and community building.