Answer the question
In order to leave comments, you need to log in
How to return the user to the same url from which he started authorization through facebook in laravel socilite?
Authorization via facebook works fine, but there is a problem - the user is always returned to a specific url from the callback method:
public function callback(SocialFacebookAccountService $service)
{
$user = Socialite::driver('facebook')->user();
$facebookId = $user->getId();
$user = $service->createOrGetUser($user);
auth()->login($user);
return redirect()->intended('/blog');
}
Answer the question
In order to leave comments, you need to log in
You need to use the http request section Retrieving The Request Path $uri = $request->path();
Then use redirect
First try this in the callback() method, and if it doesn't work, then select the path in the redirect() method of the SocialAuthFacebookController class and pass it to the callback() method, and there already redirect to the given path.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question