Closed TanmoySG closed 2 years ago
JWT or JSON Web Tokens are used to authenticate APIs and are provisioned when a user logs-in with Email and Password. JWT is used to remove or reduce the use of Password for authentication for all tasks.
Refer to this and Check Issue #53's Comments
[Parent Component]
[Checkpoints]
[Resources]
[Code Snippet for PyJWT Library]
A sample JWT implementation using pyJWT.
import jwt encoded_jwt = jwt.encode({"Name": "User"}, "secret", algorithm="HS256") print(encoded_jwt) decoded_info = jwt.decode(encoded_jwt, "secret", algorithms=["HS256"]) print(decoded_info)
Returns
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJOYW1lIjoiVXNlciJ9.uXewJOSSW5TQ6JtVHrhX-1joVkrK38OGG6T5rrHVFuM {'Name': 'User'}
Using pyjwt
pyjwt
Documentation https://pyjwt.readthedocs.io/en/stable/installation.html
Using HS512 as default Algorithm. Using default_random_secret for sample secret.
HS512
default_random_secret
JWT or JSON Web Tokens are used to authenticate APIs and are provisioned when a user logs-in with Email and Password. JWT is used to remove or reduce the use of Password for authentication for all tasks.
Refer to this and Check Issue #53's Comments
[Parent Component]
[Checkpoints]
[Resources]
[Code Snippet for PyJWT Library]
A sample JWT implementation using pyJWT.
Returns