@chachu2121/auth-sdk
v1.0.0
Published
TypeScript SDK for Bekur OIDC (OpenID Connect) authentication with PKCE support
Maintainers
Readme
@chachu2121/auth-sdk
TypeScript SDK for Bekur OIDC (OpenID Connect) authentication with PKCE support.
Installation
npm install @chachu2121/auth-sdkQuick Start
import { OAuth2Client } from '@chachu2121/auth-sdk';
const client = new OAuth2Client({
issuer: 'http://localhost:4000',
clientId: 'your-client-id',
redirectUri: 'http://localhost:3002/callback',
});
const { url, codeVerifier, state } = await client.generateAuthUrl({
scope: ['openid', 'email', 'profile'],
});
sessionStorage.setItem('code_verifier', codeVerifier!);
sessionStorage.setItem('oauth_state', state!);
window.location.href = url;
// On callback page:
const tokens = await client.getToken({
code: authorizationCode,
codeVerifier: sessionStorage.getItem('code_verifier')!,
});
const user = await client.getUserInfo(tokens.access_token);Requirements
- Node.js >= 18 (native
fetchand Web Crypto) - Browser environments with
fetchandcrypto.subtle
Publishing
npm login
npm run publish:publicAfter publishing, update consumer apps to use:
"@chachu2121/auth-sdk": "^1.0.0"License
Copyright (c) 2025-2026 Bekur s. r. o. All rights reserved.
