Files
Darkhorse7starsandHanzo Dev 4f33c5b95a fix: use correct IAM client IDs matching database
IAM DB has hanzo-billing, lux-app, zoo-app, pars-app but code
used app-hanzo, app-lux, app-zoo, app-pars which don't exist.

Co-authored-by: Hanzo Dev <[email protected]>
2026-03-28 22:57:05 -05:00

25 lines
778 B
TypeScript

import type { IamAuthConfig } from './iam-auth'
import type { BillingOrgConfig } from './config'
function getBasePath(): string {
if (typeof window === 'undefined') return ''
// Detect basePath from current URL (handles GitHub Pages /billing/ prefix)
const path = window.location.pathname
// If path starts with /billing, we're on GitHub Pages
if (path.startsWith('/billing')) return '/billing'
return ''
}
export function makeAuthConf(org: BillingOrgConfig): IamAuthConfig {
const basePath = getBasePath()
return {
iamServerUrl: org.iamServerUrl,
clientId: org.iamClientId,
redirectUri: typeof window !== 'undefined'
? `${window.location.origin}${basePath}/auth/callback`
: '',
orgName: org.id,
appName: org.iamClientId,
}
}