gpt4 book ai didi

Django GraphQL JWT : tokenAuth mutation returns "str object has no attribute decode"

转载 作者:行者123 更新时间:2023-12-03 15:27:00 24 4
gpt4 key购买 nike

目前,我正在从文档页面运行 django-graphqljwt 的基本示例。 https://django-graphql-jwt.domake.io/en/latest/quickstart.html

import graphene
import graphql_jwt


class Mutation(graphene.ObjectType):
token_auth = graphql_jwt.ObtainJSONWebToken.Field()
verify_token = graphql_jwt.Verify.Field()
refresh_token = graphql_jwt.Refresh.Field()


schema = graphene.Schema(mutation=Mutation)
但是,如果我运行 tokenAuth突变它在 GraphiQL 中向我抛出以下错误界面。 备注 如果我输入了不正确的凭据,它会抛出一个“ Please enter valid credentials”而不是下面的。
{
"errors": [
{
"message": "'str' object has no attribute 'decode'",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"tokenAuth"
]
}
],
"data": {
"tokenAuth": null
}
}

最佳答案

我在 github 上发现这是 django-graphql-jwt 的一个未解决问题。包,并能够通过诉诸 1.7.0 来解决它PyJWT 的版本.当前安装的是版本 2.0 https://github.com/flavors/django-graphql-jwt/issues/241

关于Django GraphQL JWT : tokenAuth mutation returns "str object has no attribute decode",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65704023/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com