I really dont like JWT, since I believe it has some major security problems, so since i needed a tokenization method, i made my own
- Using Fernet encryption
- Stored locally
- Nearly impossible to hand craft
- In python
- Leveraging MariaDB for speedy insertions/search
- Fernet - cryptography.fernet
- Datetime - datetime
- MariaDB Connector - mariadb
- Relative Delta - dateutil.relativedelta
- PathLib - pathlib
To generate your fernet key you can use this
from cryptography.fernet import Fernet
key = Fernet.generate_key()
f = Fernet(key)
print(key)
The generation was found here
Save the key in a file called filekey.key in the same directory as the Fetok.py file and your script
Import the Fertok.py as a library
import Fertok
and use the functions of the module in your python script just like any other library
Apache Lincense 2.0