Skip to content

field refreshToken is not async safe #337

@nrbnlulu

Description

@nrbnlulu

consider this query

obtainPayload {
    payload {
      origIat
      exp
      username
    }
    refreshExpiresIn
    # no refresh token here
    token
  }

Works fine.
But this one:

mutation obtainJWT {
  obtainPayload {
    payload {
      origIat
      exp
      username
    }
    refreshExpiresIn
    refreshToken //  <<<
    token
  }
}

gives this error

"errors": [
    {
      "message": "You cannot call this from an async context - use a thread or sync_to_async.",
      "locations": [
        {
          "line": 11,
          "column": 7
        }
      ],
    }
]

This is possibly the line.
https://github.com/KundaPanda/strawberry-django-jwt/blob/17d520efcb1f2e2cfefc2744d283b7c93ea8d540/strawberry_django_jwt/refresh_token/shortcuts.py#L24

Metadata

Metadata

Assignees

Labels

breakingBreaking ChangesbugSomething isn't workingpythonPull requests that update Python code

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions