【发布时间】:2021-04-18 14:08:45
【问题描述】:
目前我正在从文档页面运行 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
}
}
【问题讨论】:
标签: django graphql graphene-django django-graphql-jwt