jeudi 12 juillet 2018

JWT_Auth returning a token is required for getPayload even though one is supplied

I am using the JWT-Auth package in my Laravel 5.6 project.

I have a simple test which is using the getPayload method, but it keeps returning;

Tymon\JWTAuth\Exceptions\JWTException: A token is required

My method is as follows so far;

$user = factory(User::class)->create();

$token = JWTAuth::fromUser($user);
$payload = JWTAuth::getPayload($token);

If i do a dd($token) it spits out the users token correctly.

If anyone else has run into this, i would love some help.

Cheers



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire