From 724860c272afb7fe5a02645ef1c1b8d208d897f3 Mon Sep 17 00:00:00 2001 From: ivar Date: Thu, 4 Dec 2025 00:17:16 +0100 Subject: POC auth in app --- api/WhatApi/Endpoints/LoginEndpoint.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'api/WhatApi/Endpoints/LoginEndpoint.cs') diff --git a/api/WhatApi/Endpoints/LoginEndpoint.cs b/api/WhatApi/Endpoints/LoginEndpoint.cs index ee697ef..cb76696 100644 --- a/api/WhatApi/Endpoints/LoginEndpoint.cs +++ b/api/WhatApi/Endpoints/LoginEndpoint.cs @@ -13,8 +13,9 @@ public class LoginEndpoint(AppDatabase db, IConfiguration configuration) : BaseE public required string Password { get; set; } } + [AllowAnonymous] [HttpPost("~/login")] - public async Task HandleAsync(LoginRequest login, CancellationToken ct = default) { + public async Task HandleAsync([FromForm] LoginRequest login, CancellationToken ct = default) { var user = await db.Users.FirstOrDefaultAsync(c => c.Name == login.Username, ct); if (user?.PasswordHash is null) return Unauthorized(); @@ -47,6 +48,6 @@ public class LoginEndpoint(AppDatabase db, IConfiguration configuration) : BaseE var tokenString = tokenHandler.WriteToken(token); user.SetLastSeen(); await db.SaveChangesAsync(ct); - return Ok(tokenString); + return Redirect("what://lcb?code=" + tokenString); } } \ No newline at end of file -- cgit v1.3