我需要在IdentityServer Web应用程序的AccountController的Login操作中获取访问令牌 .

我在此操作方法中需要此访问令牌,以便我可以将一些与审计相关的信息记录到数据库中的表中 .

我无法弄清楚如何获取此访问令牌 .

我有以下内容:

var tokenClient = new TokenClient("https://www.example.com/Identity/connect/token", "my.web", new Secret("secret".Sha256()).ToString());

var response = await tokenClient.RequestAuthorizationCodeAsync("code", "https://www.example.com/myweb/callback.html");
var token = response.AccessToken;

令牌的值始终为NULL . 我不确定我应该为“代码”传递什么值 . 从哪里可以检索此值 .

请分享一些如何检索访问令牌的详细示例 .