Prompt
How do I support passwordless login on desktop apps?
Latest observation
To support passwordless login in desktop apps, the usual approach is to avoid asking the user for a local password at all and instead use a modern authentication flow that proves identity via another trusted device or credential.
Common approaches
1) OAuth / OIDC with browser-based login
This is the most common and recommended option.
How it works:
- Your desktop app opens the user’s default browser.
- The user signs in to your identity provider in the browser.
- The app receives an authorization result via:
- Authorization Code Flow with PKCE (preferred), often using a loopback redirect or custom URI scheme.
Why it’s good:
- No password handling in the app.
- Works well with SSO, MFA, passkeys, social login, enterprise IdPs.
- Better security than embedded webviews.
Best practice:
- Use system browser, not an embedded webview.
- Use PKCE.
- Store tokens securely in OS keychain/credential manager.
2) Passkeys / WebAuthn
This is the modern “passwordless” credential model.
How it works:
- The user authenticates using biometrics, device PIN, or a security key.
- The browser or OS handles the credential ceremony.
- Your app relies on your auth backend or IdP to issue tokens after passkey authentication.
For desktop apps:
- Typically still done through the browser or an embedded OS-backed auth UI.
- You can integrate with IdPs that support passkeys.
Why it’s good:
- Phishing-resistant.
- No shared secret to remember.
- Great UX on supported platforms.
3) Magic link / email OTP
Useful if you want a simple passwordless experience.
How it works:
- User enters email in the desktop app.
- App requests a one-time link or code.
- User completes authentication in browser or enters the code back in the app.
Pros:
- Easy to implement.
- Familiar to users.
Cons:
- Less secure than passkeys.
- Email access becomes the recovery/auth channel.
4) Device-based login / pairing
Good for apps that need to sign in on a second machine or manage accounts.
How it works:
- Desktop app displays a QR code or short pairing code.
- User approves on a phone already logged in.
- The phone confirms the login and the desktop app gets a token.
Pros:
- Great UX.
- Avoids typing credentials on the desktop.
Cons:
- Requires a companion mobile/web flow.
Recommended architecture for desktop apps
-
Use an external browser-based login flow
- Authorization Code Flow + PKCE
- Loopback redirect or custom URI scheme
-
Support passwordless at the identity provider level
- Passkeys, magic link, email OTP, or social login
- Let the IdP handle user verification
-
Use secure token storage
- Windows Credential Manager
- macOS Keychain
- Linux Secret Service / KWallet
-
Refresh tokens carefully
- Short-lived access tokens
- Rotate refresh tokens
- Revoke on sign-out
-
Avoid storing passwords locally
- Don’t save or transmit raw passwords from the desktop app
If you want true native passwordless UX
Consider:
- Passkeys via browser/system auth
- QR-code login with phone confirmation
- Platform biometrics paired with a server-issued session
What to avoid
- Embedded login forms in a webview for password entry
- Handling passwords directly in the app if you can avoid it
- Storing plaintext credentials
- Rolling your own auth protocol
If you want, I can also give you:
- a recommended flow diagram,
- a sample implementation using OAuth/OIDC + PKCE, or
- platform-specific guidance for Windows/macOS/Linux desktop apps.