flavors / django-graphql-jwt

JSON Web Token (JWT) authentication for Graphene Django
https://django-graphql-jwt.domake.io
MIT License
820 stars 173 forks source link

Is it possible to turn the token field names configurable by settings? #294

Open feslima opened 2 years ago

feslima commented 2 years ago

Hi, thank you for the project and work!

I mean, for example, when obtaining the token pairs, we perform the mutation like this:

mutation TokenAuth($username: String!, $password: String!) {
  tokenAuth(username: $username, password: $password) {
    token
    refreshToken
    payload
    refreshExpiresIn
  }
}

Suppose I want to rename the field token to access and refreshToken to refresh and perform the mutation like this:

mutation TokenAuth($username: String!, $password: String!) {
  tokenAuth(username: $username, password: $password) {
    access
    refresh
    payload
    refreshExpiresIn
  }
}

I saw that the name definitions are done here: https://github.com/flavors/django-graphql-jwt/blob/704f24e7ebbea0b81015ef3c1f4a302e9d432ecf/graphql_jwt/mixins.py#L21 and here: https://github.com/flavors/django-graphql-jwt/blob/704f24e7ebbea0b81015ef3c1f4a302e9d432ecf/graphql_jwt/mixins.py#L24

Is it possible to make these fields configurable via settings definition or is it a breaking change?