Currently I'm running a basic example of django-graphqljwt from the documentation page. 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)
However if I run the tokenAuth
mutation it throws me the below error in the GraphiQL
interface. Note that if I enter incorrect credentials it throws an "Please enter valid credentials
" instead of the below.
{
"errors": [
{
"message": "'str' object has no attribute 'decode'",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"tokenAuth"
]
}
],
"data": {
"tokenAuth": null
}
}
I found this as an open issue on github for the django-graphql-jwt
package and was able to resolve it by resorting to the 1.7.0
version of PyJWT
. Currently installed was version 2.0