mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-22 14:13:36 -07:00
Document /token response
This commit is contained in:
parent
455dcc687c
commit
fc2453bee4
1 changed files with 15 additions and 3 deletions
|
@ -16,9 +16,20 @@ using Ombi.Store.Entities;
|
||||||
using Ombi.Store.Repository;
|
using Ombi.Store.Repository;
|
||||||
using Ombi.Core.Settings;
|
using Ombi.Core.Settings;
|
||||||
using Ombi.Settings.Settings.Models;
|
using Ombi.Settings.Settings.Models;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Ombi.Controllers.V1
|
namespace Ombi.Controllers.V1
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public class Token: ActionResult
|
||||||
|
{
|
||||||
|
[JsonProperty("access_token")]
|
||||||
|
public string AccessToken { get; set; }
|
||||||
|
public DateTime Expiration { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
|
@ -47,6 +58,7 @@ namespace Ombi.Controllers.V1
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ProducesResponseType(401)]
|
[ProducesResponseType(401)]
|
||||||
|
[ProducesResponseType(typeof(Token), 200)]
|
||||||
public async Task<IActionResult> GetToken([FromBody] UserAuthModel model)
|
public async Task<IActionResult> GetToken([FromBody] UserAuthModel model)
|
||||||
{
|
{
|
||||||
if (!model.UsePlexOAuth)
|
if (!model.UsePlexOAuth)
|
||||||
|
@ -161,10 +173,10 @@ namespace Ombi.Controllers.V1
|
||||||
|
|
||||||
await _userManager.UpdateAsync(user);
|
await _userManager.UpdateAsync(user);
|
||||||
|
|
||||||
return new JsonResult(new
|
return Ok(new Token
|
||||||
{
|
{
|
||||||
access_token = accessToken,
|
AccessToken = accessToken,
|
||||||
expiration = token.ValidTo
|
Expiration = token.ValidTo
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue