@cimo/authentication
v1.1.5
Published
Authentication middleware. Light, fast and secure.
Downloads
30
Maintainers
Readme
Authentication
Authentication middleware. Light, fast and secure. Write with native Typescript code and no dependencies is used.
Publish
- npm run build
- npm login --auth-type=legacy
- npm publish --auth-type=legacy --access public
Installation
- Link for npm package -> https://www.npmjs.com/package/@cimo/authentication
Server - Example with "NodeJs Express"
- Server.ts
...
import { Ca } from "@cimo/authentication";
...
app.use(CookieParser());
...
app.get("/login", (_request: Express.Request, response: Express.Response) => {
Ca.generateCookie("ms_at_authentication", response);
response.json({ stdout: "Token generated." });
});
app.get("/profile", Ca.authenticationMiddleware, (_request: Express.Request, response: Express.Response) => {
response.json({ stdout: "Authentication ok." });
});
...