调用DiscoveryClient.GetAsync连接令牌端点时出错

时间:2018-02-15 11:37:34

标签: identityserver4

我们已将身份server4部署为aws无服务器lambda函数。但是当我们从代码调用基本授权url时(为客户端创建令牌)获取禁止错误。这是代码:

[HttpGet]
    [AllowAnonymous]
    public async Task<IActionResult> Get(string client, string secret)
    {

        IActionResult result = null;

        //discover endpoints from metadata



        var disco = await DiscoveryClient.GetAsync("https://hide-for-security-reasons/prod/");



        if (disco.IsError)
        {
            result = NotFound(disco.Error);

            return result;
        }
        //request token

        var tokenClient = new TokenClient(disco.TokenEndpoint, client, secret);

        var tokenResponse = await tokenClient.RequestClientCredentialsAsync(scope: "sup");

        if (tokenResponse.IsError)
        {
            result = NotFound(tokenResponse.Error);
        }

        result = Ok(tokenResponse.Json);

        return result;
    }

0 个答案:

没有答案