Jam¶
Instance¶
from jam import Jam
jam = Jam(auth_type="jwt", config=config)
Gen payload¶
You can either create the payload yourself and pass it to kwargs or use make_payload
.
jam.make_payload(**{"user_id": 1, "role": "admin"})
# or if you need to specify a different exp, e.g. for access token
jam.make_payload(exp=600, **{"user_id": 1})
Gen jwt token¶
token = jam.gen_jwt_token(payload)
Verify jwt token¶
jam.verify_jwt_token(
token=my_token,
check_exp=True,
check_list=False
)
If everything went well you just get your payload, if the keys didn't match then raise errors. (see API)
check_exp
¶
If we specify this flag, we check the same way, for the lifetime of the token.
check_list
¶
If you specify this flag, we do a check for sheets, see Jam lists documentation.