diadal/vue-social-auth

The response code not working with laravel sociallite

Closed this issue · 7 comments

After successfull login I am getting a response code which i am sending to laravel function but it gives error

Client error: POST https://graph.facebook.com/v3.3/oauth/access_token resulted in a 400 Bad Request response:↵{"error":{"message":"Error validating verification code. Please make sure your redirect_uri is identical to the one you (truncated...)↵"

When i am putting the same url it shows Home page of laravel app but not get the user data?

How should I use the response code from your vue-social-auth with sociallite?

Can You just help me thanks in advance!!

my Vue code =>

AuthProvider(provider) {
      var self = this;
      
      this.$auth
        .authenticate(provider)
        .then((response) => {
          console.log(provider);
          self.SocialLogin(provider, response);
        })
        .catch((err) => {
          console.log({ err: err });
        });
    },
    SocialLogin(provider,response) {
     this.$http.post(this.$store.state.apiURL+'/user/sociallogin/'+provider+"?code="+response.code).then(response => {

                    console.log(response.data)

                }).catch(err => {
                    console.log({err:err})
                })
    },

laravel Code:

Route:
Route::post('sociallogin/{provider}','AuthController@SocialSignup'); Route::get('auth/{provider}/callback', 'OutController@index')->where('provider', '.*');
Controller Data:

public function SocialSignup(Request $request,$provider)
   {
       // Socialite will pick response data automatic
       $user = Socialite::driver($provider)->stateless()->user();
       $input['name'] = $userData->name;
       $input['email'] = $userData->email;
       $input['provider'] = $provider;       

       
   }

If i am using socialite normally its working but I cannot sent response back to vue as both r in different server.
Can you please suggest how to get the user from you app code?

Yes all are created but it doesnot work