JWT
General
The Jwt
node can be used to encrypt an object to JSON web token or similarly to decrypt one to an object.
Input
Case: SIGN
Source: Receives an
Object
with the values to encrypt. Learn more on jwt.sign.
Case: VERIFY
Source: Receives the JSON web token as
String
. Learn more on jwt.sign.
Environment variables:
jwt: Requires JWT PRIVATE KEY to be set.
Output
Case: SIGN
Out: Returns a
String
with the encrypted JWT. Learn more on jwt.sign.
Case: VERIFY
Out: Returns a
Boolean
true if the token is valid and false if it's invalid. Learn more on jwt.sign.
Use Cases
Register a user to a database.
Request (Post) ➡ Jwt (Sign) ➡ Database (Add) ➡ Response (200)
Return a user's profile.
Request (Get) ➡ Jwt (verify) ➡ Database (Get) ➡ Response (200)
Last updated
Was this helpful?