Closed harmon1ca closed 7 years ago
Hi @harmon1ca
Do you have use Auth;
at the top of your file?
I have this in AuthController.php
namespace App\Http\Controllers\Auth;
use Auth;
use JWTAuth;
use Tymon\JWTAuth\Providers\JWT;
use App\User;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
but i commented "try catch" in AuthController.php
$credentials = $request->only('email', 'password');
/*try {
// verify the credentials and create a token for the user
if (! $token = JWTAuth::attempt($credentials)) {
return response()->error('Invalid credentials', 401);
}
} catch (\JWTException $e) {
return response()->error('Could not create token', 500);
}*/
$user = Auth::user();
and get warning "Expecting a token named "data.token".
In network tab i saw
Alright then you need to check the logs in this file:
storage/logs/laravel.log
It will give you a pointer on why it's returning a 500
I check log, last notice was "2017-03-10 08:26:28"
[2017-03-10 08:26:28] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'Tymon\JWTAuth\Providers\LaravelServiceProvider' not found' in /vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php:146
Stack trace:
#0 {main}
and i corected it
i have progress with this problem. I change /app/User.php add "implements JWTSubject" and getJWTIdentifier(),getJWTCustomClaims() And it work(request 200 without errors)
But after logged not redirect to my auth page
Hi, little new to this. I just pulled the latest, and was reading the docs. On JWT Auth Section under Overview it does say there will be an auto generated LoginController.php but unfortunately it is not there. Am i missing something here??
I have a problem with login form. Got a 500 error on enter(api/auth/login 500 error(anonymous function)).But if i use wrong password i get 401 AuthController.php i get 401 error(anonymous function).
i update composer.json to "tymon/jwt-auth": "1.0.*@dev" and it not helped Centos 6.7