django-graphql-jwt icon indicating copy to clipboard operation
django-graphql-jwt copied to clipboard

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

Open feslima opened this issue 3 years ago • 0 comments

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?

feslima avatar Jan 31 '22 14:01 feslima