Security | JWT Authentification
Internal Security Management
Using HTTP
Generating Tokens
import etherial from "etherial";
// ...
const user = /* Retrieve user data from your database or authentication process */;
const token = etherial.http_security.generateToken({
user_id: user.id,
// You can include additional claims or user-specific data in the token payload as needed.
});
// Now, you can use the 'token' for authentication and authorization.Using the @ShouldBeAuthentificate Decorator
@ShouldBeAuthentificate DecoratorExample app.ts (Configuration steps)
Example Auth Controller (Token Generation)
Example : User Controller (use of ShouldBeAuthentificate)
Last updated