Throw 500 error code when there is no "Token" header, different from JWT's output
{
"message": "Type error: Argument 1 passed to Symfony\\Component\\HttpKernel\\Exception\\UnauthorizedHttpException::__construct() must be of the type string, null given, called in /vendor/dingo/api/src/Auth/Auth.php on line 113",
"status_code": 500,
"debug": {
"line": 26,
"file": "/vendor/symfony/http-kernel/Exception/UnauthorizedHttpException.php",
"class": "Symfony\\Component\\Debug\\Exception\\FatalThrowableError",
...
}
}
When using jwt.auth instead of api.auth middleware, its output:
I using web guard for default because of API+Web using in project. I changed web to api from config/auth.php still same output happen. Not related with this issue.
There is no header in Postman(testing with it)
Possible Solutions
For now, I fix with using jwt.auth instead of api.auth. But its show "Not Protected" in php artisan api:routes
+------+----------+--------------------+---------------------------+---------------------------------------------------------------+-----------+------------+----------+------------+
| Host | Method | URI | Name | Action | Protected | Version(s) | Scope(s) | Rate Limit |
+------+----------+--------------------+---------------------------+---------------------------------------------------------------+-----------+------------+----------+------------+
| | POST | /api/auth/me | api.v1.auth.me | Foo\AuthController@me | No | v1 | | |
I want use api.auth because I expect this output when I use php artisan api:routes
Actual Behaviour
My
routes/api.php
fileThrow 500 error code when there is no "Token" header, different from JWT's output
When using
jwt.auth
instead ofapi.auth
middleware, its output:Expected Behaviour
I expect JWT's token not provided output
Steps to Reproduce
I using
web
guard for default because of API+Web using in project. I changedweb
toapi
fromconfig/auth.php
still same output happen. Not related with this issue.There is no header in Postman(testing with it)
Possible Solutions
For now, I fix with using
jwt.auth
instead ofapi.auth
. But its show "Not Protected" inphp artisan api:routes
I want use
api.auth
because I expect this output when I usephp artisan api:routes