Sep 11, 2020
0
Level 1
HELP!! API authentication not working.
The API calls through postman is working. My dahboard is in VUE,and from dashboard if I make axios request every request with middleware 'auth:api' is unauthenticated.
I tried removing middleware then it works, but Auth::user() value is returned null, that must mean the user isn't authenticated ,right?
It was working fine until I recently updated to laravel v7.25.0 from 7.6.2. when the error was :
Argument 2 passed to Symfony\Component\HttpFoundation\Request::setTrustedProxies() must be of the type int, array given,
Then I resolved with the help of someone in the forum by changing
protected $headers = [
Request::HEADER_FORWARDED => 'FORWARDED',
Request::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR',
Request::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST',
Request::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT',
Request::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO',
];
to :
protected $headers = Request::HEADER_X_FORWARDED_ALL;
Please or to participate in this conversation.