From fc2453bee457c815427d189b682a5758c32720fb Mon Sep 17 00:00:00 2001
From: sephrat <34862846+sephrat@users.noreply.github.com>
Date: Fri, 13 May 2022 13:20:02 +0200
Subject: [PATCH] Document /token response
---
src/Ombi/Controllers/V1/TokenController.cs | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/Ombi/Controllers/V1/TokenController.cs b/src/Ombi/Controllers/V1/TokenController.cs
index 1dd08fcbe..a0da590ab 100644
--- a/src/Ombi/Controllers/V1/TokenController.cs
+++ b/src/Ombi/Controllers/V1/TokenController.cs
@@ -16,9 +16,20 @@ using Ombi.Store.Entities;
using Ombi.Store.Repository;
using Ombi.Core.Settings;
using Ombi.Settings.Settings.Models;
+using System.Text.Json.Serialization;
+using Newtonsoft.Json;
namespace Ombi.Controllers.V1
{
+
+
+ public class Token: ActionResult
+ {
+ [JsonProperty("access_token")]
+ public string AccessToken { get; set; }
+ public DateTime Expiration { get; set; }
+ }
+
[ApiV1]
[Produces("application/json")]
[ApiController]
@@ -47,6 +58,7 @@ namespace Ombi.Controllers.V1
///
[HttpPost]
[ProducesResponseType(401)]
+ [ProducesResponseType(typeof(Token), 200)]
public async Task GetToken([FromBody] UserAuthModel model)
{
if (!model.UsePlexOAuth)
@@ -161,10 +173,10 @@ namespace Ombi.Controllers.V1
await _userManager.UpdateAsync(user);
- return new JsonResult(new
+ return Ok(new Token
{
- access_token = accessToken,
- expiration = token.ValidTo
+ AccessToken = accessToken,
+ Expiration = token.ValidTo
});
}