Identityserver 4同意页面未显示

时间:2017-06-10 19:19:58

标签: identityserver4

我设法让Identity Server 4达到我需要授予应用程序同意的程度,但是同意页面不会显示。这就是我得到的

This localhost page can’t be found No webpage was found for the web address: https://localhost:44361/consent?returnUrl=%2Fconnect%2Fauthorize%2Fconsent%3Fresponse_type%3Did_token%2520token%26client_id%3Dangular2client%26redirect_uri%3Dhttps%253A%252F%252Flocalhost%253A44380%26scope%3Dopenid%2520email%2520profile%2520securedfilesscope%2520resourcescope%26nonce%3DN0.46395672677896951497118418043%26state%3D14971184180430.1487668170892953

下面是他同意控制器的索引方法,该方法被调用以返回同意视图或页面。看起来控制器根本没有被击中,更不用说调用索引方法了

[Route("api/[controller]")]
public class ConsentController : Controller
{
    // GET: api/values
    private readonly ILogger<ConsentController> _logger;
    private readonly IClientStore _clientStore;
    private readonly IResourceStore _resourceStore;
    private readonly IIdentityServerInteractionService _interaction;

    public ConsentController(
        ILogger<ConsentController> logger,
        IIdentityServerInteractionService interaction,
        IClientStore clientStore,
        IResourceStore resourceStore)
    {
        _logger = logger;
        _interaction = interaction;
        _clientStore = clientStore;
        _resourceStore = resourceStore;
    }

    /// <summary>
    /// Shows the consent screen
    /// </summary>
    /// <param name="returnUrl"></param>
    /// <returns></returns>
    [HttpGet]
    public async Task<IActionResult> Index(string returnUrl)
    {
        var vm = await BuildViewModelAsync(returnUrl);
        if (vm != null)
        {
            return View("Index", vm);
        }

        return View("Error");
    }

}

1 个答案:

答案 0 :(得分:0)

不确定为什么会有效,但这就是发生的事情。我从同意控制器中删除了此[Route("api/[controller]")],并显示了同意页面