A dead simple true-false authentication gate, using JWT.
Why bother reinventing the wheel when you only want to know if a user is logged in?
{
username: string;
password: string;
}
{
ok: boolean;
msg: string;
token: string;
}
The token returned from register/login API is a short-life token, it is used for further token generation.
Token-gen API takes a valid token and generate a new token, with specified age and data.
{
appId: string;
token: string;
age: number;
data: string;
}
{
ok: boolean;
msg: string;
token: string;
}
Token-check API only check if a token is valid, it does not return any data in the token.
{
appId: string;
token: string;
}
{
ok: boolean;
msg: string;
}
Token-parse API verify the token and return the information contained in the token.
{
appId: string;
token: string;
}
{
ok: boolean;
msg: string;
data: string;
}