https://github.com/finki-hub/finki-auth
Node authentication library for FINKI services
https://github.com/finki-hub/finki-auth
auth fcse finki npm
Last synced: 4 months ago
JSON representation
Node authentication library for FINKI services
- Host: GitHub
- URL: https://github.com/finki-hub/finki-auth
- Owner: finki-hub
- License: mit
- Created: 2025-04-13T01:35:46.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-05T23:28:36.000Z (12 months ago)
- Last Synced: 2025-07-06T00:25:31.392Z (12 months ago)
- Topics: auth, fcse, finki, npm
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/finki-auth
- Size: 2.39 MB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# FINKI Hub / FINKI Auth
Node.js package for managing authentication and cookies for FCSE's services, built using [axios](https://github.com/axios/axios).
## Features
Currently supports the following services:
- [CAS](https://cas.finki.ukim.mk/)
- [Courses](https://courses.finki.ukim.mk/)
- [Diplomas](https://diplomski.finki.ukim.mk/)
- [Old Courses](https://oldcourses.finki.ukim.mk/)
- [Masters](https://magisterski.finki.ukim.mk/)
- [Internships](https://internships.finki.ukim.mk/)
- [Consultations](https://consultations.finki.ukim.mk/)
## Installation
You can add the package to your NPM project by running `npm i finki-auth`.
## Example
```ts
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 isCookieValid = await auth.isCookieValid(Service.COURSES);
if (!isCookieValid) 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,
});
```
## License
This project is licensed under the terms of the MIT license.