授权回复问题:我没有收到授权

时间:2019-01-28 20:40:28

标签: c# async-await openid-connect

我无法获取响应授权响应

对于我的测试,我使用Visual Studio控制台。

我在监听程序启动时放了一个端口

// create a redirect URI using an available port on the loopback address.
string redirectUri = string.Format("https://192.168.1.12:7890/");
Console.WriteLine("redirect URI: " + redirectUri);

// create an HttpListener to listen for requests on that redirect URI.
var http = new HttpListener();
http.Prefixes.Add(redirectUri);
Console.WriteLine("Listening..");
http.Start();


var options = new OidcClientOptions
{
    Authority = "https://Authority.be/",
    Flow = OidcClientOptions.AuthenticationFlow.AuthorizationCode,
    ClientId = "password",
    ResponseMode = OidcClientOptions.AuthorizeResponseMode.Redirect,
    Scope = "openid profile",
    RedirectUri = redirectUri,
    ProviderInformation = new ProviderInformation
    {
        IssuerName = "https://Authority.be",
        AuthorizeEndpoint = "https://Authority.be/oidc/authorization",
        TokenEndpoint = "https://Authority.be/oidc/token",
        KeySet = new JsonWebKeySet("{\"alg\":\"RS256\"}")
    }
};



var client = new OidcClient(options);
var state = await client.PrepareLoginAsync();

Console.WriteLine($"Start URL: {state.StartUrl}");


// open system browser to start authentication
Process.Start(state.StartUrl);

// wait for the authorization response.
HttpListenerContext context = await http.GetContextAsync();

我在==>上下文中什么也没恢复

我不去下一个指令,为什么?

在浏览器中:

https://192.168.1.12:7890/?code=9fsoqs9v1wze590mwoo104iwi1tf4vzbwckw&state=96bfb7608c4cb060f6d3c22186545cbd ==>此页面无法显示

你能帮我吗?

预先感谢

0 个答案:

没有答案