-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔒 Fix token validation and add new method
Added a validate method to the Token class and refactored the create method to include an optional expires_delta parameter.
- Loading branch information
1 parent
abdac73
commit 0468633
Showing
2 changed files
with
19 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
from FastAuth import User, Token | ||
from datetime import timedelta | ||
from time import sleep | ||
|
||
u = User("1", "oliver") | ||
|
||
t = Token.create(u) | ||
t = Token.create(u, timedelta(seconds=5)) | ||
|
||
print(Token.validate(t)) | ||
print(t) | ||
|
||
sleep(5) | ||
|
||
print(Token.validate(t)) | ||
print(t) |