Gohan
Gohan

Reputation: 63

AngularJS TokenMismatchException

I have AngularJS in the Frontend and Laravel 5.2 in the Backend Development.

I tried a POST Request and tested with POSTMAN Extension but get an TokenMismatchException.

Here is my code:

Routes.php:

Route::group(
[
    'prefix' => 'api',
],
function ()
{
    Route::post( '/saveArticle',
        function ( Request $request )
        {
            echo 'Test';
        }
    );
}

);

APIservice.js:

        APIservice.saveArticle = function ( oArticle, callback )
        {
            $log.debug( 'Method: APIservice.saveArticle()' );

            $http.post(sBaseUrl + '/api/dummy/').then(
                function successCallback( response )
                {
                    callback( response );
                },
                function errorCallback( response )
                {

                }
            );
        };

Since Laravel 5 you have to do nothing with the csrf-token don't you? How can I fix this Issue? I tried a lot what I found on Google but nothing helps.

Edit: Here is what I get from POSTMAN http://kopy.io/Gsq8e

Upvotes: 0

Views: 208

Answers (1)

Webistan
Webistan

Reputation: 357

You may disable verify token by commenting below line in Kernal.php

\App\Http\Middleware\VerifyCsrfToken::class,

Upvotes: 0

Related Questions