I'm on Laravel 5.1 using Cartalyst's Sentinel as my authentication system. I'm using angular on my front-end.
I have a form at http://domain.com/login
that sends a POST request to api.domain.com/login
. If the user has entered correct credentials api.domain.com/login
returns {'success': true}
which my front-end looks at and eventually forwards to http://ift.tt/10RfXwH
This is where the problem arises. The relevant portion of my dashboard controller:
if( Sentinel::check() ) {
return view('dashboard');
} else {
return redirect()->route('login');
}
is not detecting the user as logged in. And keeps sending me back to domain.com/login
I suspect this is happening because the logging in part is happening at api.domain.com
and we're checking to see if the user is logged in at domain.com
and the browser isn't sending the relevant sentinel cookies. The Sentinel docs doesn't mention anything about this.
If my suspicions are correct how can I allow Sentinel authenticate a user for both api.domain.com
and domain.com
? If my suspicions aren't correct, what is happening here?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire