lundi 2 octobre 2017

Vue.js + Laravel SPA - Socialite stateless Facebook Login

First to say that I already implement session based facebook login with laravel socialite and I registered proper facebook acc for developers and create app, but because of SPA I need to change to stateless solution... The redirect throws "Response for preflight is invalid (redirect)" and check the following config, images and code...

My vue.js app works on localhost:8080 and backend laravel app on localhost:8000

I installed barryvdh/laravel-cors an d implement standard login with JWTToken

I already install laravel socialite

So, I setup config/services with proper credentials already

    'facebook' => [
    'client_id' => 'xxxxxxxx',
    'client_secret' => 'xxxxxxxxx',
    'redirect' => 'http://localhost:8000/login/facebook/callback',
]

I also register a good routes and I tested them 1000 times...

And when a GET send request it cannot be redirected on fb because of Response for preflight is invalid (redirect):

SocialiteController

public function redirectToFacebookProvider()
{
    return Socialite::driver('facebook')->stateless()->redirect(); // this throws error !!!
}

the error which I get in console is like on picture

enter image description here

  1. It should open to me a popup to login on facebook ?
  2. Why I have trouble with this redirect ? Any help ?


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire