✨ Challenge retrieve api
This commit is contained in:
		| @@ -74,6 +74,19 @@ public class AuthController( | ||||
|         return challenge; | ||||
|     } | ||||
|  | ||||
|     [HttpGet("challenge/{id:guid}")] | ||||
|     public async Task<ActionResult<Challenge>> GetChallenge([FromRoute] Guid id) | ||||
|     { | ||||
|         var challenge = await db.AuthChallenges | ||||
|             .Include(e => e.Account) | ||||
|             .ThenInclude(e => e.Profile) | ||||
|             .FirstOrDefaultAsync(e => e.Id == id); | ||||
|  | ||||
|         return challenge is null  | ||||
|             ? NotFound("Auth challenge was not found.")  | ||||
|             : challenge; | ||||
|     } | ||||
|  | ||||
|     [HttpGet("challenge/{id:guid}/factors")] | ||||
|     public async Task<ActionResult<List<AccountAuthFactor>>> GetChallengeFactors([FromRoute] Guid id) | ||||
|     { | ||||
|   | ||||
| @@ -355,7 +355,7 @@ public class ConnectionController( | ||||
|                 connection.Account,  | ||||
|                 HttpContext,  | ||||
|                 deviceId ?? string.Empty); | ||||
|             return Redirect($"/auth/callback?context={challenge.Id}"); | ||||
|             return Redirect($"/auth/callback?challenge={challenge.Id}"); | ||||
|         } | ||||
|  | ||||
|         // Register new user | ||||
|   | ||||
| @@ -291,6 +291,5 @@ public class OidcCallbackData | ||||
|     public string Code { get; set; } = ""; | ||||
|     public string IdToken { get; set; } = ""; | ||||
|     public string? State { get; set; } | ||||
|     public string? CodeVerifier { get; set; } | ||||
|     public string? RawData { get; set; } | ||||
| } | ||||
| @@ -16,7 +16,7 @@ | ||||
|     <script> | ||||
|         (function () { | ||||
|             const urlParams = new URLSearchParams(window.location.search); | ||||
|             const token = urlParams.get('token'); | ||||
|             const token = urlParams.get('challenge'); | ||||
|  | ||||
|             console.log("Authentication token received."); | ||||
|  | ||||
| @@ -36,7 +36,7 @@ | ||||
|  | ||||
|             // For mobile apps that use custom URI schemes | ||||
|             try { | ||||
|                 const customSchemeUrl = `solian://auth/callback?token=${encodeURIComponent(token ?? 'done')}`; | ||||
|                 const customSchemeUrl = `solian://auth/callback?challenge=${encodeURIComponent(token ?? 'done')}`; | ||||
|                 window.location.href = customSchemeUrl; | ||||
|                 console.log("Attempting to redirect to custom scheme:", customSchemeUrl); | ||||
|             } catch (e) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user