首页 > 解决方案 > 使用 Postman 测试 OAuth 身份验证代码流

问题描述

我正在尝试使用 Postman 来测试身份验证代码流 - 但它似乎无法正常工作。我不确定这是 IS4 还是 Postman 问题。

我使用此处的文档创建了一个新实例:

http://docs.identityserver.io/en/latest/quickstarts/0_overview.html

创建了一个新客户端:

            new Client
            {
                ClientId = "code",

                RedirectUris =
                {
                    "https://www.getpostman.com/oauth2/callback"
                },

                AllowedGrantTypes = GrantTypes.CodeAndClientCredentials,

                 ClientSecrets =
                {
                    new Secret("apisecret".Sha256())
                },

                AllowedScopes = 
                { 
                    IdentityServerConstants.StandardScopes.OpenId,
                    IdentityServerConstants.StandardScopes.Profile,
                    "api1" 
                },

                AllowOfflineAccess = true
            }

然后使用 Postman 尝试获取 id 令牌。

邮差

然后我使用 bob/bob 或 alice/alice 登录,当我单击登录按钮时,它只是重定向回登录屏幕。

我期待访问令牌被检索。

在使用 SPA 客户端对演示实例( https://demo.identityserver.io/ )进行测试时,我也遇到了同样的问题。

如果我使用 SoapUi 它可以工作。

标签: postmanidentityserver4

解决方案


推荐阅读