mont-auth
v1.0.8
Published
SDK to create an all function JWT auth system
Readme
MontAuth
This is a simple JWT auth system made in TypeScript. It's as simple as it gets, but it's a good starting point for a more complex system.
How to use
- Clone the repository into your project
- Run
npm install - Create a
.envfile in the root of the project with the following content:
JWT_SECRET="your_secret_key"
JWT_ACCESS_TOKEN_EXPIRES_IN=3600
JWT_REFRESH_TOKEN_EXPIRES_IN=86400Functions
montAuth.createSession(payload: object, options: Options): MontResponse- Creates a new access and refresh tokenmontAuth.validate(token: string, options: Options): MontResponse- Checks if an access token is validmontAuth.refresh(token: string, options: Options): MontResponse- Refreshes a refresh tokenmontAuth.auto(token: string, options: Options): MontResponse- Automatically validates or refreshes a token
