Search code examples
laravelvue.jsvue-clilaravel-socialite

Issue in social login with google in vuejs (vueCLI)


I have used frontend in vuejs(vueCLI) and backend in laravel api. I have issue in social login with google in vuejs. I used vue-social-auth package. Here is this link (https://forum.vuejs.org/t/laravel-vue-social-auth-spa/54341). I have follow this link code. Login with Google Properly Work. But I can't get a response in User info like name, email or google_id.. please help


Solution

  • On your callback controller try to get user data using this code:

    $platform='google';        
    $userData = Socialite::driver($platform)->user();
    

    When You disable session You could use stateless method. The stateless method may be used to disable session state verification. This is useful when adding social authentication to an API:

    $platform='google';        
    $userData = Socialite::driver($platform)->stateless()->user();