kandi-login / Tauri
Available
Lightweight desktop authentication for Tauri apps. OAuth flow via the system browser with deep-link callback. Tokens stored securely using the Tauri stronghold plugin.
Quick Start
1
Clone the example project
git clone https://github.com/KandiForge/kandi-packages.git
cd kandi-packages/examples/tauri2
Install dependencies
npm install3
Run the Tauri development build
npm run tauri dev
# Opens the Tauri window — pre-configured for the reference server4
Click "Login" — opens the system browser, then deep-links back to the app
Auth Configuration
src/auth.config.ts
// src/auth.config.ts
import { createTauriAuthClient } from '@kandiforge/kandi-login/tauri';
export const auth = createTauriAuthClient({
authServerUrl: 'https://api.packages.kandiforge.com',
authBasePath: '/api/auth',
providers: ['google', 'github'],
// Deep-link scheme registered in tauri.conf.json
deepLinkScheme: 'myapp',
// Tokens stored via Tauri stronghold plugin
secureStorage: true,
});Switch to Your Server
The example app points to the KandiForge reference server by default. Once you have your own server running:
// Change authServerUrl to your own server:
authServerUrl: 'https://your-api.example.com'Run the conformance validator against your server to confirm it implements all required endpoints.
Test Personas for Automated Testing
Use the test persona system to authenticate in Playwright, and WebDriver tests without launching a browser OAuth flow.
test/auth.setup.tsNo browser needed
// test/auth.setup.ts
async function authenticateForTest(personaId: string) {
// Seed personas (idempotent)
await fetch('https://your-api.example.com/api/auth/test/seed', {
method: 'POST',
});
// Get real JWT tokens — bypasses browser OAuth
const res = await fetch(
'https://your-api.example.com/api/auth/test/login-as',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ personaId }),
}
);
const { access_token, refresh_token } = await res.json();
// Inject tokens into the Tauri app's auth state
await invoke('set_auth_tokens', { accessToken: access_token, refreshToken: refresh_token });
}Default personas: admin-alex, designer-dana, viewer-val, new-user-naya. See all personas