flask_graphql_auth.decorators module

flask_graphql_auth.decorators.decode_jwt(encoded_token, secret, algorithm, identity_claim_key, user_claims_key)[source]

Decodes an encoded JWT

Parameters:
  • encoded_token – The encoded JWT string to decode
  • secret – Secret key used to encode the JWT
  • algorithm – Algorithm used to encode the JWT
  • identity_claim_key – expected key that contains the identity
  • user_claims_key – expected key that contains the user claims
Returns:

Dictionary containing contents of the JWT

flask_graphql_auth.decorators.get_jwt_data(token, token_type)[source]

Decodes encoded JWT token by using extension setting and validates token type

Parameters:
  • token – The encoded JWT string to decode
  • token_type – JWT type for type validation (access or refresh)
Returns:

Dictionary containing contents of the JWT

flask_graphql_auth.decorators.mutation_header_jwt_refresh_token_required(fn)[source]

A decorator to protect a mutation.

If you decorate a mutation with this, it will ensure that the requester has a valid refresh token before allowing the mutation to be called.

flask_graphql_auth.decorators.mutation_header_jwt_required(fn)[source]

A decorator to protect a mutation.

If you decorate a mutation with this, it will ensure that the requester has a valid access token before allowing the mutation to be called. This does not check the freshness of the access token.

flask_graphql_auth.decorators.mutation_jwt_refresh_token_required(fn)[source]

A decorator to protect a mutation.

If you decorate a mutation with this, it will ensure that the requester has a valid refresh token before allowing the mutation to be called.

flask_graphql_auth.decorators.mutation_jwt_required(fn)[source]

A decorator to protect a mutation.

If you decorate a mutation with this, it will ensure that the requester has a valid access token before allowing the mutation to be called. This does not check the freshness of the access token.

flask_graphql_auth.decorators.query_header_jwt_refresh_token_required(fn)[source]

A decorator to protect a query resolver.

If you decorate an query resolver with this, it will ensure that the requester has a valid refresh token before allowing the resolver to be called.

flask_graphql_auth.decorators.query_header_jwt_required(fn)[source]

A decorator to protect a query resolver.

If you decorate an resolver with this, it will ensure that the requester has a valid access token before allowing the resolver to be called. This does not check the freshness of the access token.

flask_graphql_auth.decorators.query_jwt_refresh_token_required(fn)[source]

A decorator to protect a query resolver.

If you decorate an query resolver with this, it will ensure that the requester has a valid refresh token before allowing the resolver to be called.

flask_graphql_auth.decorators.query_jwt_required(fn)[source]

A decorator to protect a query resolver.

If you decorate an resolver with this, it will ensure that the requester has a valid access token before allowing the resolver to be called. This does not check the freshness of the access token.

flask_graphql_auth.decorators.verify_jwt_in_argument(token)[source]

Verify access token

Parameters:token – The encoded access type JWT string to decode
Returns:Dictionary containing contents of the JWT
flask_graphql_auth.decorators.verify_refresh_jwt_in_argument(token)[source]

Verify refresh token

Parameters:token – The encoded refresh type JWT string to decode
Returns:Dictionary containing contents of the JWT