目前,我正在从文档页面运行 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
}
}