I am solving issue in API of laravel 4.2 application.
I downloaded project and setup in local.
I signup using given email and password and it gives successfully logged in and throw api_token
which is stored in database. Now if I use that API token in header it throws error:
{"status":false,"message":"Api Token is missing","code":"404"}
because it doesn't get api_token
which is sent putting in header.
If I try to die and dump that header it gives null.
It works fine in online server and recieves api_token
, and everything works fine but if I try to work on same file in local it gives error.
Please help me.
Header:
Accept : Application/json
api_token: ****************
it throws api_token
as null if we try to catch it.
The actual problem it throws is:
{"status":false,"message":"Api Token is missing","code":"404"}
You may try -
(dash) instead of _
(underscore) in the header name as:
api-token: ****************
And get it in laravel as:
request()->header('api-token');