Loading repository data…
Loading repository data…
finki-hub / repository
TypeScript based authentication library for FCSE's online services for Node.js
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Node.js package for managing authentication and cookies for FCSE's services.
Currently supports the following services:
You can add the package to your NPM project by running npm i finki-auth.
import {
CasAuthentication,
Service,
isCookieValid,
isCookieHeaderValid,
} from "finki-auth";
const credentials = {
username: "example",
password: "secret_password",
};
const auth = new CasAuthentication(credentials);
await auth.authenticate(Service.COURSES);
// Get array of cookie objects
const cookies = await auth.getCookie(Service.COURSES);
// Get cookie header directly for sending requests
const cookieHeader = await auth.buildCookieHeader(Service.COURSES);
// Check if the cookie is still valid, and if not, call `authenticate` again
const valid = await auth.isCookieValid(Service.COURSES);
if (!valid) await auth.authenticate(Service.COURSES);
// There are also some utility functions available:
const isCookieValidStandalone = await isCookieValid({
service: Service.COURSES,
cookies,
});
const isCookieHeaderValidStandalone = await isCookieHeaderValid({
service: Service.COURSES,
cookieHeader,
});
This project is licensed under the terms of the MIT license.