我可以通过浏览器开发工具查看前通道通信,但如何查看或记录后通道通信以了解流程?
具体来说,我希望看到当授权代码被交换为令牌时的http流量。
到目前为止,我没有成功尝试:
- 添加到appSettings.json:"System.Net.Http.HttpClient":"调试">
- 添加到Program.cs:ConfigureLogging(x=>x.AddConsole(((
- 已添加到Startup.cs:app。UseHttpLogging(显然可以在.net 6预览版4中找到(
谢谢。
感谢@abdusco和@Martin。使用你提供的指针,我能够找到更多的信息。
为了其他人的利益,以下是要添加到Startup::Configure((中的代码片段,源代码作为参考:
IdentityModelEventSource.Logger.LogLevel = EventLevel.Verbose;
IdentityModelEventSource.ShowPII = true;
var listener = new TextWriterEventListener(new StreamWriter(Console.OpenStandardOutput())
{
AutoFlush = true,
});
listener.EnableEvents(IdentityModelEventSource.Logger, EventLevel.LogAlways);
参考编号:https://gist.github.com/jorrit/0712ed32534b45ccca393e4c86b08526