🚀. Socket Launch Week Day 3:Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions.Learn more
Sign In

kerliix-oauth

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kerliix-oauth

Official Kerliix OAuth SDK for Node.js and browser

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

Kerliix OAuth SDK

Official Kerliix OAuth 2.0 SDK for Node.js and Browser

npm version Downloads License: MIT Build Status Node.js Version

Overview

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.

Installation

npm install kerliix-oauth

or using yarn:

yarn add kerliix-oauth

Quick Start

import 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);

Configuration Options

OptionRequiredDescription
clientIdYour app’s client ID from Kerliix developer portal
clientSecret⚙️Required for server-side (authorization code flow)
redirectUriThe callback URI registered in your app
baseUrlYour Kerliix OAuth base URL, e.g. https://auth.kerliix.com

OAuth Flow

  • User clicks login → Redirect to Kerliix via getAuthUrl()
  • Kerliix authenticates → Redirects back with ?code=XYZ
  • Your app exchanges codeexchangeCodeForToken(code)
  • Use token → Access user data via getUserInfo()
  • Optional → Automatically refresh expired tokens

API Reference

new KerliixOAuth(config)

Initializes the client.

const client = new KerliixOAuth({
  clientId: "...",
  clientSecret: "...",
  redirectUri: "...",
  baseUrl: "https://api.kerliix.com"
});

getAuthUrl(scopes?: string[], state?: string): string

Generates an authorization URL for login/consent.

const url = client.getAuthUrl(["openid", "profile", "email"], "xyz123");

exchangeCodeForToken(code: string): Promise<TokenResponse>

Exchanges an authorization code for access and refresh tokens.

refreshTokenIfNeeded(): Promise<TokenResponse | null>

Checks if the token is expiring and automatically refreshes it if needed.

getUserInfo(accessToken?: string): Promise<UserInfo>

Fetches the user’s profile data using a valid access token.

revokeToken(token: string): Promise<boolean>

Revokes an access or refresh token.

Token Caching

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

License

MIT © Kerliix Corporation

Keywords

oauth2

FAQs

Package last updated on 28 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts