Another new question is here, but hopefully someone can shed some light:
I am using Socialite with Laravel 5, and I want to be able to redirect the user to a page on the site after logging in. The problem is that using
return redirect('any-path-I-put-here');
just redirects back to "social-site / login? code = afkjadfkjdslkfjdlkfj ..." (where "social site" is any site that is used, for example, facebook, twitter, google, etc.)
So, it seems to me that the redirect () function in the Socialite / Contracts / Provider interface overrides any redirection that I try to do after the fact.
Just to clarify, my routes are configured correctly. I tried every version of the "redirect" that you can imagine ("to", "back", "designed", "Redirect :: etc."), And the method is called from my Auth Controller (although I tried it elsewhere as well).
The question is, how do I override this redirect () when I finished storing and registering the user using the socialite user? Any help is appreciated! Thank you in advance.
Code containing the specified call forwarding:
public function socialRedirect( $route, $status, $greeting, $user )
{
$this->auth->login( $user, true );
if( $status == 'new_user' ) {
\Session::flash( 'new_registration', true );
return redirect()->to( $route );
}
else {
return redirect()->to( $route )->with( [ 'greeting' => $greeting ] );
}
}
... SocialAuth, , 500 , , , , , .. , , Social Auth:
private function socialLogin( $socialUser, $goto, $provider, $status, $controller )
{
if( is_null( $goto ) ) {
$goto = 'backlot/' . $socialUser->profile->custom_url;
}
if( $status == 'new_user' ) {
return $controller->socialRedirect($goto, $status, null, $socialUser);
}
else {
$message = 'You have successfully logged in with your ' .
ucfirst( $provider ) . ' credentials.';
$greeting =
flash()->success( 'Welcome back, ' . $socialUser->username . '. ' . $message );
return $controller->socialRedirect($goto, $status, $greeting, $socialUser);
}
}