我正在尝试通过调用/ authorize手动实现身份验证工作流程,并使用redirect_uri返回302,它将在Location http响应标头中将授权代码作为查询字符串。
当我使用OpenIdConnect库执行此操作时,在Location标头中的重定向url中得到了302响应。
当我使用以下代码手动拨打电话时
var handler = new HttpClientHandler()
{
AllowAutoRedirect = true
};
using (HttpClient client = new HttpClient(handler))
{
string url2 =
"https://sample.oktapreview.com/oauth2/auspx13uvj6eHSM9c0h7/v1/authorize?
"response_type=code&"+"client_id=0oarcfbl1dwEszi1343343&"+
"state=Uy1Sa1pNcXFsMVlscV9qQVFkTjdyRzJTaW1mSnpxxxxxxxxxxL&"+
"redirect_uri=http%3A%2F%2Flocalhost%3A4200%2Fhome&"+
"scope=openid%20groups%20profile%20email&"+
"code_challenge=xDz_AAOV0Cggf560t4kqEdDXQW3slDFKy34Pp6XTYJQ&"+
"code_challenge_method=S256&"+
"nonce=Uy1Sa1pNcXFsMVlscV9qQVFkTjdyRzJTaW1mSnxxxxxxxx";
HttpRequestMessage message2 = new HttpRequestMessage(HttpMethod.Get, url2);
var response2 = client.SendAsync(message2);
response2.Wait();
var res = response2.Result;
}
我不断收到200条响应,并且标题中的位置为空。
如何使此呼叫返回302?这与身份提供商或我处理代码的方式有关吗?
我想在dotnet核心中做到这一点