- Socialite Version: ^4.3
- Laravel Version: 6
- PHP Version: 7.3.8
- Database Driver & Version:MySQL
Description:
I'm using multiple auth guards. For that I have multiple callbacks for each guard. But redirectUrl doesn't seem to update the redirectUrl and keep throwing redirect_uri mismatch on facebook and google.
Steps To Reproduce:
- clean install laravel
- setup customer and worker guard.(not using users table for this)
- setup routes as follows
//social account worker sign up/sign in related routes
Route::get('worker/{provider}', 'Auth\AuthController@redirectToProvider')->middleware('web');
Route::get('worker/{provider}/callback', 'Auth\AuthController@handleProviderCallback')->name('worker.provider')->middleware('web');
for customer
Route::get('customer/{provider}', 'Auth\AuthController@redirectToProvider')->middleware('web');
Route::get('customer/{provider}/callback', 'Auth\AuthController@handleProviderCallback')->name('customer.provider')->middleware('web');
-setup provider id, key and default url to customer as follows
FACEBOOK_URL=http://localhost:8000/api/customer/facebook/callback
- add providers configs in config/services
- in redirectToProvider method of customer
$redirectUrl = route('customer.provider', ['provider' => $provider]);
return Socialite::driver($provider)
->redirectUrl($redirectUrl)
->redirect();
At this point, everything works fine
Now if I run the redirectToProvider method for worker which is as follows
$redirectUrl = route('worker.provider',['provider' => $provider]);
return Socialite::driver($provider)->redirectUrl($redirectUrl)->redirect();
It throws
"Client error: `POST https://graph.facebook.com/v3.3/oauth/access_token` resulted in a `400 Bad Request` response:\n{\"error\":{\"message\":\"Error validating verification code. Please make sure your redirect_uri is identical to the one you (truncated...)\n"
for facebook and almost same error for google.
I have tried to override env file at runtime and sending redirectUrl using "with"