TelegramAktienBot/api/auth.py
H4CK3R-01 ecc532b752 Extracted frontend from webservice to new directory
Updated directory structure
Updated .gitignore
2022-03-17 17:11:00 +01:00

19 lines
333 B
Python

import os
import jwt
from apiflask import HTTPTokenAuth
auth = HTTPTokenAuth()
@auth.verify_token
def verify_token(token):
if token is None:
return False
try:
jwt.decode(token, os.getenv('SECRET_KEY'), algorithms=["HS256"])
return True
except jwt.exceptions.DecodeError:
return False