我想在没有 python 库的情况下手动生成 jwt 令牌。我为此搜索了详细信息或教程,但找不到。python 中有关 jwt 的所有信息都包含在库中。有什么资源可以让我在 python 中生成 jwt 令牌吗?
我想创建一个这样的模型。
{
"id": 7653,
"name": "Vortl 123",
"category": [
{
"name": "Electronic",
"url": "electronic",
"id": 1
}, {
"name": "Phone",
"url": "phone",
"id": 2
},
{
"name": "Mobile Phone",
"url": "mobile-phone",
"id": 3
}
}
Run Code Online (Sandbox Code Playgroud)
我使用 odm 参考文献创建了文档。代码就是这些。
这是产品类别。
/**
* @ApiResource
*
* @Document
*/
class Product
{
/**
* @ODM\Id(strategy="INCREMENT", type="integer")
*/
private $id;
/**
* @ODM\Field(type="string")
* @Assert\NotBlank
*/
public $name;
public function __construct()
{
$this->categories = new ArrayCollection();
}
/**
* @ODM\ReferenceMany(targetDocument=Category::class, inversedBy="product", cascade={"persist"}, storeAs="id")
*/ …
Run Code Online (Sandbox Code Playgroud)