Category : laravel-socialite

I have fully functional Socialite social login with Google and Facebook but i want to add another step that is "ask a password before logging in". This function logs the user immediately after successfully logging in with the provider: public function callback(Request $request, $provider, SocialAccountsService $service) { if ($request->has("error")) { return redirect()->route("website.index"); } try { ..

Read more

I am using Laravel socialite for authentication and i want the users to be able to connect multiple social accounts. Login/register using socialite works but after the user is logged in and they want to connect their other social accounts, socialite throws LaravelSocialiteTwoInvalidStateException (without using ->stateless()) this exception. I tried using Socialite::driver($provider)->stateless()->user() as well but ..

Read more

I am using Laravel Socialite with the Microsoft Oauth provider – https://socialiteproviders.com/Microsoft/#installation-basic-usage and was wondering if I can get more information from the user? If I die and dump the returned OAuth2User I get the following: token refreshToken expiresIn id nickname name email avatar displayName givenName jobTitle and so on. I was wondering if its ..

Read more

I am working in Laravel 8 and vue and am trying to implement Okta logout functionality. In Okta’s explanation of working with Vue they have the code shown below. Link to docs: https://developer.okta.com/docs/guides/sign-users-out/vue/sign-out-of-okta/ My question is: where do the values for this.$auth and this.$parent.authenticated and this.$auth.getIdToken() come from? In my component if I console.log() this.$auth ..

Read more

I am currently using Laravel Socialite for Facebook login in my web project. How do I get the access token and expiresin, then store them inside users table in the database? LaravelSocialiteTwoUser {#366 ▼ +token: "EAAqbG7tzw3sBAEK6ePXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" +refreshToken: null +expiresIn: 5174967 +id: "429285XXXXXXXXXX" +nickname: null +name: "Facebook Display Name" +email: "[email protected]" +avatar: "https://graph.facebook.com/v3.3/429285XXXXXXXXXX/picture?type=normal" +user: array:3 [▼ ..

Read more

So I have a Laravel 8 application that uses Fortify for authentication and I recently set up two factor authentication. All is good with a normal user/password except I had previously setup login with Socialite. The way I did social logins is I set a random password for the user when they log in as ..

Read more

I’m using socialite for facebook login but i’m getting this error In services.php i have ‘facebook’ => [ ‘client_id’ => ‘XXXXXXXXXX’, ‘client_secret’ => ‘XXXXXXXXXXXXXXX’, ‘redirect’ => ‘https://XXXXXXXXXXX.in/auth/facebook/callback’, ], Same i have in site url : https://XXXXXXX.in/ In Valid OAuth Redirect URIs : https://XXXXXXX.in/auth/facebook/callback Any Solution Please,Thanks Sourc..

Read more

I’m using socialite for facebook login but the issue is if i’m already login in facebook account then before login it should force user to select pop up this code is working for google login but i want it in facebook login also which is not working. public function facebookRedirect() { return Socialite::driver(‘facebook’)->with(["prompt" => "select_account"])->redirect(); ..

Read more

I have this function for google login function : public function loginWithGoogle() { try { $googleUser = Socialite::driver(‘google’)->user(); $user = User::where(‘google_id’, $googleUser->id)->first(); if($user){ Auth::login($user); return redirect(‘/home’); } else{ $createUser = User::create([ ‘name’ => $googleUser->name, ’email’ => $googleUser->email, ‘google_id’ => $googleUser->id, ‘password’ => encrypt(‘[email protected]’) ]); Auth::login($createUser); return redirect(‘/home’); } } catch (Exception $exception) { dd($exception); } ..

Read more

I have this link on my modal popup <li><a href="{{ route(‘auth/google’) }}" target="_blank"><i class="fab fa-google-plus-g"></i></a></li> and routes is Route::get(‘google’, ‘[email protected]’)->name(‘auth/google’); Route::get(‘/auth/google-callback’, ‘[email protected]’); Services.php ‘google’ => [ ‘client_id’ => ‘XXXXXXXXXXXXXXXX.apps.googleusercontent.com’, ‘client_secret’ => ‘XXXXXXXXXXXXX’, ‘redirect’ => ‘http://localhost:8000/login/google/callback’, ], Controller: <?php namespace AppHttpControllers; use AppHttpControllersController; use IlluminateHttpRequest; use AppUser; use Socialite; use IlluminateSupportFacadesAuth; use Exception; class SocialiteAuthController extends ..

Read more

I recently tried to fetch gender in my laravel project by google OAuth by using the scope inside services.php -> google => [scopes => [‘https://www.googleapis.com/auth/user.gender.read’]]. I don’t understand why, but it didn’t work it threw me an error abstractProvider.php:236 i.e InvalidStateException. I researched on it found that we must add stateless() in Socialite::driver($provider)->user(); like Socialite::driver($provider)->stateless()->user();. ..

Read more

I try to make an application with 3 separated projects. On my local machine I created a: server.application ( Laravel 8 REST API with passport project ) login.application ( Laravel 8 project with socialite to connect to the server.application ) client.application ( Vue, React or other front-end framework ) The reason I need a login.application ..

Read more

i want to login with facebook, i create laravel authentication, i add button login with facebook, i install laravel socialite package by command composer require laravel/socialite, i add configuration in config/services: ‘facebook’ => [ ‘client_id’ => env(‘FACEBOOK_CLIENT_ID’), ‘client_secret’ => env(‘FACEBOOK_CLIENT_SECRET’), ‘redirect’ => ‘http://localhost:8000/laravel-socialite/public/login/facebook/callback’, ], I added in routes/web.php the routes: Route::get (‘login/facebook’,[AppHttpControllersAuthLoginController::class, ‘redirectToFacebook’])->name(‘login.facebook’); Route::get(‘login/facebook/callback’,[AppHttpControllersAuthLoginController::class,’handleFacebookCallback’]); I ..

Read more