I'm trying to implement the sign in with google option with Laravel Socialite. Although i'm using stateless authentication of Socialite, it doesn't allow me to go to google login page. The request fails with request url (google login page url) along with 302 status code.
=== AuthController ===
`use Laravel\Socialite\Facades\Socialite;
public function redirectToGoogle()
{
return Socialite::driver('google')->stateless()->redirect();
}
public function handleGoogleCallBack()
{
$googleUser = Socialite::driver('google')->stateless()->user();
return response()->json([
"google" => $googleUser
]);
}`
I want user to be able to sign in with google and get user data back from the call back.
=== Frontend ===
`<button @click="userStore.loginWithGoogle()">
<img src="../assets/images/google_icon.webp" alt="icon" class="social-icon">
</button`
`async loginWithGoogle() {
try {
const response = await axiosInstance.get("auth/google");
console.log(response.data.url);
} catch (error) {
console.log(error);
}
}`