yii2-jwt
yii2-jwt copied to clipboard
Setting unknown property: sizeg\\jwt\\Jwt::jwtValidationData
Hi!
Sorry, I'm new to PHP. I think this issue might be because of autoloading?
Error:
"name": "Unknown Property",
"message": "Setting unknown property: sizeg\\jwt\\Jwt::jwtValidationData",
"code": 0,
"type": "yii\\base\\UnknownPropertyException",
"file": "[/vendor/yiisoft/yii2/base/Component.php](http://localhost:8080/Users/<censored>/venueview-api/vendor/yiisoft/yii2/base/Component.php)",
I have this in my web.php under components:
'jwt' => [
'class' => \sizeg\jwt\Jwt::class,
'key' => '!zf$5obLKs6HeACySCkGafA&*j4jhGt65F@',
'jwtValidationData' => \app\components\JwtValidationData::class,
],
I created a new folder called 'components' with this only file within:
<?php
namespace app\components;
use Yii;
class JwtValidationData extends \sizeg\jwt\JwtValidationData
{
public function init() {
$jwtParams = Yii::$app->params['jwt'];
$this->validationData->setIssuer($jwtParams['issuer']);
$this->validationData->setAudience($jwtParams['audience']);
$this->validationData->setId($jwtParams['id']);
parent::init();
}
}
Did you solve this issue
for me the file \sizeg\jwt\JwtValidationData is missing after installing sizeg/yii2-jwt via composer php 8.2
@charlietyn I ended up implementing authentication via https://github.com/lcobucci/jwt instead.
i fix the problem with sizeg already