首页 > 解决方案 > 如何使用 owin 交易访问令牌的代码

问题描述

我正在使用 Identity Server 4 V3 和带有 Owin 客户端的 .Net Framework V4.6。我正在尝试实现authroization_code流程,但无法弄清楚如何将 Identity Server 提供的代码换成访问和 id 令牌。如何在以下事件处理程序中执行此操作:

                AuthorizationCodeReceived = async context =>
                {
                    var code = context.Code;
                    //Now what?
                    return;
                }

标签: owinidentityserver4

解决方案


见文档: https ://identityserver4.readthedocs.io/en/latest/endpoints/token.html?highlight=grant_type%3D%22code%22#example

POST /connect/token

client_id=client1&
client_secret=secret&
grant_type=authorization_code&
code=hdh922&
redirect_uri=https://myapp.com/callback

推荐阅读