Configuration
Jotbox can be configured with the following arguments
-
encode_keyRequired
This key is used to sign your JWTs. It is also used to verify them (unless a separate
decode_keyis specified)You should use a strong randomly generated string for this and store it securely.
-
decode_keyDefault:
encode_keyWhen specified this token is used to decode your JWTs. (for use with asymmetric signing algorithms)
-
payload_typeDefault:
jotbox.PayloadThis is the model that is used for creating token payloads. You can subclass and add extra fields that you want encoded in the token.
The default payload has the following standard claims:
jti,iat,exp(optional) -
encode_algorithmDefault:
"HS512"Algorithm used to sign JWTs. This can be any algorithm supported by PyJWT.
-
decode_algorithmsDefault:
["HS512", ]A list of algorithms that are accepted when decoding tokens. Any algorithms supported by PyJWT are accepted.
-
leewayDefault:
0(no leeway)Number of seconds of leeway to allow when verifying things like expiry times and idle timeouts.
It can be good to set this to a few seconds to account for clock skew. -
expires_inDefault:
None(no expiry)Number of seconds of how long new tokens are valid for. By default tokens never expire.
The expiry time is encoded in the JWT as
expclaim. -
idle_timeoutDefault:
None(no idle timeout)Number of seconds before a token is deleted from whitelist due to inactivity. This can only be used when whitelist is provided.
-
whitelistDefault:
NoneAn instance of
jotbox.whitelist.base.Whitelistuse as a storage backend for whitelisted tokens. Whitelisting is disabled when not provided. -
jwt_optionsDefault:
{}(default pyjwt options)Dict of options forwarded to
PyJWT.decodewhen verifying tokens.