asphanyx-sdk
v0.1.2
Published
TypeScript SDK for interacting with the IAM Service auth backend.
Readme
asphanyx-sdk
TypeScript SDK for client-side authentication flows against the IAM backend.
Scope
This SDK is intentionally limited to tenant-aware auth endpoints:
signInsignUprefreshTokenlogoutverifyTokenforgotPasswordresetPasswordgetGoogleAuthUrlclaimGooglegetConfirmRegistrationUrl
Tenant administration endpoints are not part of this package.
Install
npm install asphanyx-sdkUsage
import { AuthSDK } from 'asphanyx-sdk';
const sdk = new AuthSDK({
apiKey: process.env.NEXT_PUBLIC_TENANT_ANON_KEY!,
baseUrl: process.env.NEXT_PUBLIC_AUTH_API_BASE!,
});
const session = await sdk.auth.signIn({
email: '[email protected]',
password: 'strong-password',
});Security notes
- Do not place backend secrets (for example
JWT_SECRET, SMTP credentials, DB URLs) in frontend env variables. - The SDK only needs:
baseUrl(public API URL)apiKey(anon_keyfor tenant routing)
- Store user access/refresh tokens in secure storage on your frontend.
Development
npm install
npm run build
npm run lintPublish
npm publish --access public