Jwt-auth: Route [login] not defined (How return right the status and message?)

Created on 12 Sep 2018  路  4Comments  路  Source: tymondesigns/jwt-auth

Subject of the issue

Problem when try access route that need token with my spa, show me "Route [login] not defined.", but needs show unautorized status.

Your environment

| Q | A
| ----------------- | ---
| Bug? | no
| New Feature? | no
| Framework | Laravel
| Framework version | 5.7
| Package version | 1.0.0-rc.2
| PHP version | 7.2

Most helpful comment

@richellyitalo
you should check line 216 in file "vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php"
you could put Accept: application/json in your request header

All 4 comments

Try name Your route Route::post('login', 'AuthController@login')->name('login');

But it's on api, the right way it's return {message: unathenticated} throught rest.

@richellyitalo
you should check line 216 in file "vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php"
you could put Accept: application/json in your request header

Thanks, @john-xu .
After check that and run php artisan make:auth it's works.
Thanks guys and have a nice day!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

heroghost picture heroghost  路  3Comments

gandra picture gandra  路  3Comments

hfalucas picture hfalucas  路  3Comments

lbottoni picture lbottoni  路  3Comments

gamelife1314 picture gamelife1314  路  3Comments