Is is possible to change the value of redirect_uri set in config/services.php at runtime?
I tried doing like this:
return $socialite->driver('facebook')->redirectUrl(newUrl)->redirect();
but it throws an error saying that the redirect_uri should match the one from the OAuth dialog. Upon further checking of the error message, the value of redirect_uri is empty so apparently, the redirectUrl() method does not work.
PS:
This is the socialite version that I'm using defined in composer.json:
"laravel/socialite": "^2.0"
The solution to this is:
public function redirectToProvider($accountType, $provider)
{
return Socialite::driver($provider)
->with(['redirect_uri' => "YOUR_NEW_URL"])
->stateless()
->redirect();
}
With this method, you could override any of the values in the http request (including the scope).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With