Skip to content

vocaltech/auth-passportjs-jwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JWT basics with jsonwebtoken library

Generate key pair

const { privateKey, publicKey } = generateKeyPair()

Issue JWT token - without expires

issue_jwt = (payload: object, privateKey: string)

Issue JWT token - with expires

issue_jwt_expires = (payload: object, privateKey: string, expiresIn: string)

Verify JWT token

verify_jwt(jwtToken, publicKey)

Decode JWT token

const { header, payload } = decode_jwt(jwtToken)