Official Kerliix OAuth 2.0 SDK for Node.js and Browser
Kerliix OAuth provides a simple and secure way to integrate Kerliix authentication into your Node.js or browser-based apps. It handles the full OAuth 2.0 flow including:
- Building authorization URLs
- Exchanging authorization codes for tokens
- Token caching & auto-refresh
- Fetching user profile data
- Revoking tokens
Built with TypeScript, compatible with both Node.js and browser environments.
npm install kerliix-oauthor using yarn:
yarn add kerliix-oauthimport KerliixOAuth from "kerliix-oauth";
const client = new KerliixOAuth({
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
redirectUri: "https://yourapp.com/callback",
baseUrl: "https://api.kerliix.com"
});
// Step 1: Redirect user to login
const authUrl = client.getAuthUrl(["openid", "profile", "email"]);
console.log("Login via:", authUrl);
// Step 2: Exchange the code for tokens
// const token = await client.exchangeCodeForToken("OAUTH_CODE");
// Step 3: Fetch user profile
// const user = await client.getUserInfo(token.access_token);| Option | Required | Description |
|---|---|---|
clientId |
✅ | Your app’s client ID from Kerliix developer portal |
clientSecret |
⚙️ | Required for server-side (authorization code flow) |
redirectUri |
✅ | The callback URI registered in your app |
baseUrl |
✅ | Your Kerliix OAuth base URL, e.g. https://auth.kerliix.com |
- User clicks login → Redirect to Kerliix via
getAuthUrl() - Kerliix authenticates → Redirects back with
?code=XYZ - Your app exchanges code →
exchangeCodeForToken(code) - Use token → Access user data via
getUserInfo() - Optional → Automatically refresh expired tokens
Initializes the client.
const client = new KerliixOAuth({
clientId: "...",
clientSecret: "...",
redirectUri: "...",
baseUrl: "https://api.kerliix.com"
});Generates an authorization URL for login/consent.
const url = client.getAuthUrl(["openid", "profile", "email"], "xyz123");Exchanges an authorization code for access and refresh tokens.
Checks if the token is expiring and automatically refreshes it if needed.
Fetches the user’s profile data using a valid access token.
Revokes an access or refresh token.
The SDK automatically caches tokens in memory and:
- Refreshes them 30 seconds before expiry
- Clears cache when tokens are revoked
- Works seamlessly in Node.js and browser environments
MIT © Kerliix Corporation