Skip to content

kulagind/jwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JWT Authentication

It's an auth app generating JWT access and refresh tokens. It also storages users and has token's black list.

API

POST /signup - registration by email, name and password
body:

{
    email: string;
    password: string
}

response:

{
    accessToken: string;
}

POST /login - login by email and password
body:

{
    email: string;
    password: string
}

response:

{
    accessToken: string;
}

POST /update_access - renew access token and refresh token if it's expired
It requires cookie (with credentials) and header Authorization: Bearer <ACCESS_TOKEN>
response:

{
    accessToken: string;
}

GET /private/user - get current user
It requires header Authorization: Bearer <ACCESS_TOKEN>
response:

{
    id: string;
    email: string;
    name: string;
}

GET /private/user/:id - get user by ID
It requires header Authorization: Bearer <ACCESS_TOKEN>
response:

{
    id: string;
    email: string;
    name: string;
}

Internal error codes

-1 - Private error: Request parameters are incorrent 0 - Unextected error 1 - User already exists 2 - User with this email and password doesn't exist 3 - Access or refresh token is invalid 4 - Access token is expired (needed to refresh) 5 - Refresh token was blocked (need to login again)

How to run

There will be a description about building and starting

Успех!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages