- "laravel/framework": "5.7.*"
- "tymon/jwt-auth": "dev-develop"
I am trying to create a JWT token with added custom claims, without auth (which means that I am not looking to create a token from credentials.) This is for the purpose of creating tokens that do not require logins, such as forgot/reset-password, etc.
- using Tymon/JWTAuth (https://github.com/tymondesigns/jwt-auth) Since there was an issue with Latest Laravel, it was recommended to load the latest dev ( 1.0.x-dev ). I have tried the following code without avail:
class OTL extends Model implements JWTSubject
use JWTAuth;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Tymon\JWTAuth\Facades\JWTFactory;
public static function getJwtToken($customerId, $action, $token){
$customClaims = ['action' => $action, 'customer-id' => $customerId, 'token' => $token];
$factory = JWTFactory::customClaims($customClaims);
$payload = $factory->make();
$token = JWTAuth::encode($payload);
return $token;
I am receiving an error: JWT payload does not contain the required claims
.
I am expecting to receive the token that holds the payload above.