Xamarin 使用acr_值=";idp:Google“;使用Xmarin';s IdentityModel.OidcClient不会跳过identityserver4上的登录页
我正在使用for xamarin oidcclient对用户进行身份验证 如果用户选择外部提供者,我想跳过登录页面,我可以在示例代码中通过添加额外的参数acr_值来做到这一点:Xamarin 使用acr_值=";idp:Google“;使用Xmarin';s IdentityModel.OidcClient不会跳过identityserver4上的登录页,xamarin,asp.net-identity,identityserver3,identityserver4,Xamarin,Asp.net Identity,Identityserver3,Identityserver4,我正在使用for xamarin oidcclient对用户进行身份验证 如果用户选择外部提供者,我想跳过登录页面,我可以在示例代码中通过添加额外的参数acr_值来做到这一点: var result = await _oidcClient.LoginAsync(extraParameters: new { acr_values="idp:Google" }); 它起作用了,但我无法实现IdentitySeler4,我的客户端配置是: new Client {
var result = await _oidcClient.LoginAsync(extraParameters: new { acr_values="idp:Google" });
它起作用了,但我无法实现IdentitySeler4,我的客户端配置是:
new Client
{
ClientId = "mvc",
ClientName = "MVC Client",
AllowedGrantTypes = GrantTypes.HybridAndClientCredentials,
RequireConsent=false,
AccessTokenType=AccessTokenType.Jwt,
AllowAccessTokensViaBrowser=true,
ClientSecrets = {
new Secret("secret".Sha256())
},
// where to redirect to after login
RedirectUris = { "http://192.168.1.6.nip.io:13013/Home/", "io.identitymodel.native://TrainAppCallback" },
// where to redirect to after logout
PostLogoutRedirectUris = { "http://192.168.1.6.nip.io:13013/signout-callback-oidc" },
AllowedScopes = new List<string>
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
"Advancio.TrainApp.WebApi"
},
AllowOfflineAccess = true,
RequirePkce = true
}
这假设您在管道中注册了具有
Google
身份验证方案的Google身份验证中间件。还要检查服务器日志。我更新了我的问题,以包括授权请求的服务器日志,AuthenticationScheme与acr_值中的名称相同,我已检查了IdentityServer4。Demo要在我的末端发现任何不同的东西,我想知道是否应该在UserService之类的地方实现重定向?!通过探索演示项目,我发现我必须自己实现这种行为,多亏了IdentityServer4示例,我找到了我需要的示例项目。
info: IdentityServer4.Endpoints.AuthorizeEndpoint[0]
ValidatedAuthorizeRequest
{
"ClientId": "mvc",
"ClientName": "MVC Client",
"RedirectUri": "io.identitymodel.native://TrainAppCallback",
"AllowedRedirectUris": [
"http://192.168.5.165.nip.io:13013/Home/",
"io.identitymodel.native://TrainAppCallback",
"io.identitymodel.native://callback"
],
"SubjectId": "anonymous",
"ResponseType": "code id_token",
"ResponseMode": "fragment",
"GrantType": "hybrid",
"RequestedScopes": "openid profile Advancio.TrainApp.WebApi",
"Nonce": "9723a6643f38b51711400677cb30db73c4c0dda2de20c7ccebf71a06937be32f943d29e04763571337cda90391bb994afaf1d3188992955f045b16825133771b",
"AuthenticationContextReferenceClasses": [
"idp:Google"
],
"Raw": {
"client_id": "mvc",
"response_type": "code id_token",
"scope": "openid profile Advancio.TrainApp.WebApi",
"redirect_uri": "io.identitymodel.native://TrainAppCallback",
"nonce": "9723a6643f38b51711400677cb30db73c4c0dda2de20c7ccebf71a06937be32f943d29e04763571337cda90391bb994afaf1d3188992955f045b16825133771b",
"code_challenge": "Fpdz7OYUZPyE47Qvc3efwg8-UuAmLhiOQmCAYMqoSZw",
"code_challenge_method": "S256",
"acr_values": "idp:Google"
}
}