feat: Implement magic link authentication

This commit introduces a new magic link authentication flow.
The desktop client can now request a temporary, one-time-use token from
the server.
This token is then used to open a URL in the system browser, which
redirects to the server.
The server consumes the token, installs a regular web session, and
redirects the user
This commit is contained in:
2026-04-19 16:00:12 +02:00
parent 0d5c2f5888
commit 76e8ee18e9
13 changed files with 690 additions and 39 deletions
+1 -3
View File
@@ -10,15 +10,13 @@ use tracing::warn;
use crate::config::Config;
use crate::error::AppError;
use crate::web_session::SessionStore;
use crate::web_session::{SESSION_COOKIE, SessionStore};
/// Truncate a session token to a non-sensitive prefix for logs.
fn token_prefix(token: &str) -> String {
token.chars().take(8).collect()
}
const SESSION_COOKIE: &str = "session";
/// Extracted from the X-API-Key header on every authenticated request.
pub struct AuthenticatedUser {
pub slug: String,