flask_graphql_auth.util module

flask_graphql_auth.util.create_access_token(identity, user_claims=None)[source]

Create a new access token.

Parameters:
  • identity – The identity of this token, which can be any data that is json serializable. It can also be a python object
  • user_claims – User made claims that will be added to this token. it should be dictionary.
Returns:

An encoded access token

flask_graphql_auth.util.create_refresh_token(identity, user_claims=None)[source]

Creates a new refresh token.

Parameters:
  • identity – The identity of this token, which can be any data that is json serializable. It can also be a python object
  • user_claims – User made claims that will be added to this token. it should be dictionary.
Returns:

An encoded refresh token

flask_graphql_auth.util.get_jwt_claims()[source]

In a protected resolver or mutation, this will return the dictionary of custom claims in the JWT that is accessing the endpoint. If no custom user claims are present, an empty dict is returned instead.

flask_graphql_auth.util.get_jwt_identity()[source]

In a protected resolver or mutation, this will return the identity of the JWT that is accessing this endpoint. If no JWT is present,`None` is returned instead.

flask_graphql_auth.util.get_raw_jwt()[source]

In a protected endpoint, this will return the python dictionary which has all of the claims of the JWT that is accessing the endpoint. If no JWT is currently present, an empty dict is returned instead.