lundi 29 août 2016

Laravel - JWT Auth The token could not be parsed from the request

I have added following code in my middleware for user authentication with JWT Auth, which works fine for all the routes handled by the middleware.

$this->auth = JWTAuth::parseToken()->authenticate();
return $next($request);

But for one route with Post Method where the token is getting passed properly but still I am getting JWTException - The token could not be parsed from the request, on the same route when I tried

 dd($request->input('token'));
 $this->auth = JWTAuth::parseToken()->authenticate();

output:

"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9iaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0OjgwMDFcL2F1dGhcL2xvZ2luIiwiaWF0IjoxNDcyNTI4NDU0LCJleHAiOjE0NzI1MzIwNTQsIm5iZiI6MTQ3MjUyODQ1NCwianRpIjoiM2E0M2ExYTZlNmM5NjUxZDgxYjZhNDcxMzkxODJlYjAifQ.CH8ES2ADTCrVWeIO8uU31bGDnH7h-ZVTWxrdXraLw8s"

I am able to see the Valid Token which I am using to access another routes and which is working flawlessly for all other routes.

Thanks in advance!!!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire