@cavicode/sso-webclient (0.1.0-alpha)

Published 2026-06-25 00:09:59 +03:00 by CaviCode

Installation

@cavicode:registry=
npm install @cavicode/sso-webclient@0.1.0-alpha
"@cavicode/sso-webclient": "0.1.0-alpha"

About this package

CaviCode.SSO.WebClient

SSO BFF web client for CaviCode Network panels.

Consumes the /auth/* endpoints exposed by CaviCode.SSO.NetClient (server-side BFF). Does NOT handle OIDC directly — the BFF does all OIDC. This client just consumes the session.

Install

npm install @cavicode/sso-webclient

Usage

import { createPanelAuthApi, type PanelAuthHttpClient } from '@cavicode/sso-webclient'

// http is your axios/fetch wrapper implementing PanelAuthHttpClient
const auth = createPanelAuthApi(http)

// Get current user
const user = await auth.getCurrentUser()
// { subject, email, displayName, roles, role }

// Build login URL
const loginUrl = auth.buildLoginUrl('/dashboard')

// Refresh session
const user = await auth.refreshSession()

// Logout
const endSessionUrl = await auth.logout(true)

API

  • createPanelAuthApi(http, rolePriority?) — create auth API client
  • getCurrentUser()GET /auth/me
  • buildLoginUrl(returnUrl?, forceLogin?) — builds /auth/login?returnUrl=...
  • refreshSession()POST /auth/refresh-session
  • logout(federated?)POST /auth/logout?federated=...
  • pickPrimaryRole(roles, priority?) — pick primary role by priority
  • normalizePanelUser(payload, rolePriority?) — normalize user payload

Dependencies

Development dependencies

ID Version
typescript ^5.7.0

Keywords

cavicode sso oidc bff auth
Details
npm
2026-06-25 00:09:59 +03:00
72
MIT
alpha
3 KiB
Assets (1)
Versions (1) View all
0.1.0-alpha 2026-06-25