jwt.generate_jwt(claims[, priv_key, ...]) | Generate a JSON Web Token. |
jwt.process_jwt(jwt) | Process a JSON Web Token without verifying it. |
jwt.verify_jwt(jwt[, pub_key, allowed_algs, ...]) | Verify a JSON Web Token. |
Functions for generating and verifying JSON Web Tokens.
Generate a JSON Web Token.
Parameters: |
|
---|---|
Return type: | unicode |
Returns: | The JSON Web Token. Note this includes a header, the claims and a cryptographic signature. The following extra claims are added, per the JWT spec: |
Process a JSON Web Token without verifying it.
Call this before verify_jwt() if you need access to the header or claims in the token before verifying it. For example, the claims might identify the issuer such that you can retrieve the appropriate public key.
Parameters: | jwt (str or unicode) – The JSON Web Token to verify. |
---|---|
Return type: | tuple |
Returns: | (header, claims) |
Verify a JSON Web Token.
Parameters: |
|
---|---|
Return type: | tuple |
Returns: | (header, claims) if the token was verified successfully. The token must pass the following tests: |
Raises: | If the token failed to verify. |
---|