Support the ongoing development of Laravel.io →
Authentication Requests Packages
Last updated 4 months ago.
0

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.

Thanks Phil

0

yea, me too. would be great to know if someone found a solution.

0

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.

0

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:

https://myapi.com/auth/{provider}/token

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?

0

Sign in to participate in this thread!

LoadForge

Your banner here too?

jkirkby91 jkirkby91 Joined 19 May 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.