Skip to content

Conversation

@kernoeb
Copy link
Collaborator

@kernoeb kernoeb commented Jan 14, 2026

Summary

Implemented a simplified authentication flow for external applications (e.g., desktop apps) to authenticate users via the simple-directory service.

Changes

  • API Endpoints:
    • GET /api/auth/apps/authorize: Validates application configuration and redirects to the UI for user confirmation.
    • POST /api/auth/apps/authorize: Generates a short-lived authorization code after user confirmation.
    • POST /api/auth/apps/login: Exchanges the authorization code for session cookies.
  • UI Improvements:
    • Added a new authorizeApp step in the login page for user confirmation.
    • Added an appRedirected success state with a message and automatic window closing attempt.
    • Improved layout spacing for the login card and logo.
  • Configuration:
    • Added applications support in global and site-level configurations (ID, Name, Redirect URIs).
  • Localization: Added French and English translations for the new authorization steps.
  • Testing: Added comprehensive integration tests in test-it/external-apps-authorization.ts.

Add /api/auth/authorize and /api/auth/token endpoints to enable OAuth2
authorization code flow for desktop applications and external clients.

- Add oauth2Server config with typed client definitions
- Add oauthCodes MongoDB collection with 5-minute TTL
- Support configurable redirect URIs per client
- Generate access_token and id_token_ex for authenticated users
- GET /api/auth/apps/authorize now redirects to login UI with step=authorizeApp
- Added POST /api/auth/apps/authorize endpoint that generates the auth code after user confirms
- Added authorizeApp step in login.vue with confirmation message and buttons
- User must click 'Authorize' to generate code, can click 'Cancel' to deny access
- Added i18n translations for authorization UI (fr/en)
- Show 'You can close this tab' message after redirecting to app
- Attempt window.close() for better UX
- Improve spacing between logo, card and maildev link
- Fix icon syntax to use mdiCheckCircle variable
Window close cannot reliably detect if user confirmed custom protocol
URLs (my-app://), and window.close() only works for windows opened via
window.open(). Users will now see the success message and close manually.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants