asp.net - 使用 authorization_code 授权类型请求令牌
问题描述
我想使用授权代码授予类型请求令牌,我在这里看到它:https ://identitymodel.readthedocs.io/en/latest/client/token.html#
var response = await client.RequestAuthorizationCodeTokenAsync(new AuthorizationCodeTokenRequest
{
Address = IdentityServerPipeline.TokenEndpoint,
ClientId = "client",
ClientSecret = "secret",
Code = code,
RedirectUri = "https://app.com/callback",
// optional PKCE parameter
CodeVerifier = "xyz"
});
但我不知道在哪里code
得到CodeVerifier
。
解决方案
如您所知,授权代码授予包含几个步骤,您需要从RFC 6749 - The OAuth2.0 Authorization Framework中阅读它们。
授权服务器使用之前提供的重定向 URI(在请求中或客户端注册期间)将用户代理重定向回客户端。重定向 URI 包括授权代码和客户端之前提供的任何本地状态。
RFC 文档中有一个流程图,可以帮助您弄清楚如何获得代码。
总而言之:您的客户端应发送授权代码及其请求,然后您将代码发送到授权服务器并检查其有效性。
推荐阅读
- pivot-table - 如何将数据透视图 xvalues 设置为数据字段值
- cassandra - Cassandra - 如何按最新时间戳分组
- python - Pytelegrambotapi 引发 ReadTimeout 错误
- c# - 如何让 WPF 图像控件从 WriteableBitmap 线性解释颜色通道?
- django - 为什么没有注册使用自定义 javascript 所做的更改
- html - 嵌套可点击元素的明智方法
- android - 使用 kotlin 创建 Firestore 数据库模型
- python - 有什么方法可以使用像 ModelMultipleChoiceField 这样的 ajax-select AutoCompleteSelectMultipleField 模型
- javascript - 在使用顺风的同时在 reactjs 中添加样式
- python - Python:无法正确提取 csv 文件