Packages/kandi-login
🔐

kandi-login

Multi-platform Authentication Framework

One authentication protocol, every platform. Write your auth server once with kandi-login/server, then connect from any client SDK.

5 Client SDKs

Web
Electron
Tauri
iOS
Android

1 Server SDK

kandi-login/server

Built-in Test Personas

Every kandi-login server ships with a test persona system for automated testing. Test clients authenticate using an API key and secret to get real JWTs — no browser-based OAuth flow needed.

This is essential for end-to-end testing with Playwright, Cypress, XCTest, and Espresso test harnesses. Personas use the same auth infrastructure as production — real JWT signing, real token refresh, real user records.

Persona IDEmailRoleUse Case
admin-alexalex@test.kandiforge.comadminSystem Administrator — full access, can manage users and settings
designer-danadana@test.kandiforge.comeditorDesigner — can create and edit content
viewer-valval@test.kandiforge.comviewerViewer — read-only access across the app
new-user-nayanaya@test.kandiforge.comuserNew User — freshly registered, minimal permissions
login-as flowNo browser needed
// Seed test personas (run once)
POST /api/auth/test/seed
// → { success: true, seeded: ["admin-alex", "designer-dana", ...] }

// Login as a test persona — returns real JWTs
POST /api/auth/test/login-as
Content-Type: application/json
{ "personaId": "admin-alex" }

// → { access_token: "eyJ...", refresh_token: "...", expires_in: 3600 }
// Use the access_token exactly like a production token

Client SDKs

Reference Server

api.packages.kandiforge.com is a working reference server. Use it to verify your client works before building your own server.

1

Download the example client for your platform

Each platform has a ready-to-run example app pre-configured to connect to the reference server.

2

Run it against the reference server

Verify that OAuth login, token refresh, and test personas all work correctly with the example.

3

Build your own server using kandi-login/server

Implement the UserAdapter interface, configure your OAuth providers, and deploy your server.

4

Switch the URL to your own server

Change authServerUrl in the client config. Run the conformance validator to confirm compatibility.