Jwt-auth dos not recognized token via bearer header but can via GET
beshoo opened this issue · comments
beshoo commented
Subject of the issue
Describe your issue here.
Your environment
Q | A |
---|---|
Bug? | yes |
New Feature? | no |
Framework | Laravel |
Framework version | 9.x.y |
Package version | current |
PHP version | 8 |
Steps to reproduce
Tell us how to reproduce this issue.
Expected behaviour
Recognized token via bearer header as well as GET
Actual behavior
When am using PostMan, I can not authenticate my request via bearer. only via GET,
http://example.dev/me?token=eyJhbGciOiJIUzI1NiI...
beshoo commented
it seems Laravel can not see any header here
\vendor\laravel\framework\src\Illuminate\Http\Concerns\InteractsWithInput.php
public function bearerToken()
{
$header = $this->header('Authorization', '');
$position = strrpos($header, 'Bearer ');
if ($position !== false) {
$header = substr($header, $position + 7);
return str_contains($header, ',') ? strstr($header, ',', true) : $header;
}
}