从IdentityServer检索访问令牌

时间:2018-07-27 19:01:33

标签: token identityserver4 access

我需要在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。我不确定应该为“代码”传递什么值。从哪里可以获取该值。

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

0 个答案:

没有答案
相关问题