【发布时间】:2020-11-17 14:20:28
【问题描述】:
我正在尝试将身份服务器4与asp.net身份集成,文档非常好https://identityserver4.readthedocs.io/en/latest/quickstarts/6_aspnet_identity.html
但我希望能够在不通过登录页面的情况下建立连接,而是在传递参数的同时通过简单的 GET 进行直接访问。
用这个方法
var response = await _httpClient.RequestPasswordTokenAsync(new PasswordTokenRequest
{
Address = _disco.TokenEndpoint,
ClientId = "resourceownerclient",
ClientSecret = "dataEventRecordsSecret",
Scope = "email openid dataEventRecords offline_access",
UserName = user,
Password = password
});
我有一个“invalid_request”错误
这是客户的声明:
new Client
{
ClientId = "resourceownerclient",
AllowedGrantTypes = GrantTypes.ResourceOwnerPasswordAndClientCredentials,
AccessTokenType = AccessTokenType.Jwt,
AccessTokenLifetime = 3600,
IdentityTokenLifetime = 3600,
UpdateAccessTokenClaimsOnRefresh = true,
SlidingRefreshTokenLifetime = 30,
AllowOfflineAccess = true,
RefreshTokenExpiration = TokenExpiration.Absolute,
RefreshTokenUsage = TokenUsage.OneTimeOnly,
AlwaysSendClientClaims = true,
Enabled = true,
ClientSecrets= new List<Secret> { new Secret("dataEventRecordsSecret".Sha256()) },
AllowedScopes = {
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
IdentityServerConstants.StandardScopes.OfflineAccess,
"dataEventRecords"
},
AllowAccessTokensViaBrowser=true
}
以这种方式使用 Asp.net Identity 的推荐方法是什么?
【问题讨论】:
标签: asp.net-core asp.net-identity postman identityserver4