OAuth Api call success

This commit is contained in:
Paul Schneider 2016-06-13 13:33:32 +02:00
commit f7c836aebd
21 changed files with 1510 additions and 1779 deletions

View file

@ -7,6 +7,7 @@ using Microsoft.AspNet.Mvc;
using Yavsc.ViewModels.Account;
using System.Security.Claims;
using Microsoft.Extensions.Logging;
using Yavsc.Models.Auth;
namespace Yavsc.WebApi.Controllers
{
@ -121,18 +122,14 @@ namespace Yavsc.WebApi.Controllers
[HttpGet("~/api/me"),Produces("application/json")]
public async Task<IActionResult> Me ()
{
if (User==null) return new BadRequestObjectResult(
new {
error = "no user"
});
if (User==null)
return new BadRequestObjectResult(
new { error = "user not found" });
var uid = User.GetUserId();
if (uid == null)
return new BadRequestObjectResult(
new {
error = "not identified"
});
return Ok(await UserManager.FindByIdAsync(uid));
new { error = "user not identified" });
return Ok(new Me(await UserManager.FindByIdAsync(uid)));
}
}