vendredi 14 octobre 2016

Laravel+Angular Project's Auth and CSRF token not working in Production

csrf_token and X-XSRF-TOKEN have been added via Angular

$http.defaults.headers.common['csrf_token'] = CSRF_TOKEN;
$http.defaults.headers.common['X-XSRF-TOKEN'] = X_XSRF_TOKEN;

The project is working fine on local server but not in production. I see TokenMismatchException after submitting a form and Auth::attempt() works fine during login. But after login when I access user's id by Auth::user()->id for other route then I see no login user.

I also checked my cookies in local server. I can see XSRF-TOKEN and laravel-session there but in production my cookie list is empty.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire