I am using laravel Socialite for laravel social authentication .
Redirect after social login is not working : Check code below
//routes
Route::get('social/{provider}',['as'=>'social.login','uses'=>'SocialController@login']);
Route::get('social/callback/{provider}',['as'=>'social.callback','uses'=>'SocialController@callback']);
//controller code
namespace App\Http\Controllers;
use Socialite;
use Illuminate\Routing\Controller;
use Auth; use Request;
class SocialController extends Controller
{
/**
* Redirect the user to the social authentication page.
*
* @return Response
*/
public function login($provider = NULL){
return Socialite::driver($provider)->redirect();
}
/**
* Obtain the user information from social auth.
*
* @return Response
*/
public function callback($provider = NULL){
$user = Socialite::driver($provider)->stateless()->user();
$this->SocialLogin($user,$provider);
}
private function SocialLogin($user,$provider){
//print_r($user) all looks fine .
$socialUser = info after saving / checking user data fetched from social user
Auth::login($socialUser);
return redirect()->route('dashboard');
//everything looks fine . user is getting logined but redirect is not working . it is not able to redirect user to any route i specify
}
}
I have been researching on this from couple of hours now . But no solutions looks working . I have set url in my app.php and domain session.php : url => 'http://test.dev' and domain => 'test.dev' . in case if it is session issue .
Let me know if i am missing something here.
Thanks .
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire