A python implementation of resuelve-auth
Using pip
:
pip install git+https://github.com/resuelve/resuelve-auth-python.git
Using poetry
poetry add git+https://github.com/resuelve/resuelve-auth-python.git
Validate a existing token.
ttl
can be used to define the quantity of seconds that token will be valid.
from resuelve_auth import auth
from resuelve_auth.exceptions import ResuelveAuthError
SECRET = "some secret key"
try:
metadata = auth.validate_token(SECRET, "a token", ttl=10)
except ResuelveAuthError as ex:
# TODO: handle error here
Build a new token with some data inside of it
from resuelve_auth import auth
SECRET = "some secret key"
meta = {"some": "data"}
token = auth.build_token(SECRET, meta)
Enjoy 🎉