0

I authenticate my user only through laravel, so angular does not know about it. But I need to do a $http.post on a "before auth" route with angular in order to get some profil info:

laravel route.php

Route::post('profile', array('before' => 'auth', function()
{
    // Only authenticated users may enter...
}));

angular app.js

$http.post("/profile").success(function (data) {
    $scope.profile = data;
  });

For now I get an internal server error (500) with a "Illuminate\Session\TokenMismatchException" because laravel think I'm not logged in.

Could someone help me out with this?

Thanks in advance :)

alskaa
  • 394
  • 1
  • 3
  • 14

1 Answers1

0

My mistake, it was a csrf filter that was causing this error, not the auth filter...

For reference to my question:

AJAX Requests are identical with regular requests in regards to session data. Anything that depends on Session or Auth will work with an AJAX call.

link to thread

alskaa
  • 394
  • 1
  • 3
  • 14