【发布时间】:2020-07-18 16:58:16
【问题描述】:
我正在使用带有 IdentityServer4 的 AspNetCore 2.2.0。
问题/重现问题的步骤 我正在使用 iPhone 进行“使用苹果登录”。点击本机应用程序中的登录按钮会打开一个登录网页,该网页托管在 windows docker 容器中。在登录网页上,单击“使用 Apple 登录”会显示 IOS 原生弹出窗口以继续使用已与该应用程序关联的帐户或“使用不同的 Apple ID”。点击继续按钮时,会显示一个白色屏幕,该屏幕冻结在 appleid.apple.com 上并且没有任何反应。 IPhone native popup-tapping on continue results in white screen 此外,如果该应用在首次正常运行之前未与任何 Apple ID 关联。在退出并尝试使用上述步骤登录时,出现白屏。 “使用不同的 Apple ID”流程运行良好。 我不确定我的代码或 IdentityServer4 中是否有任何错误。根据日志,正在从 Apple 接收回调 /connect/authorize/callback,但它不会反映在浏览器上。非常感谢任何帮助。
日志文件的相关部分 trce:IdentityServer4.ResponseHandling.AuthorizeInteractionResponseGenerator[0] ProcessInteractionAsync dbug:Equinox.Account.Services.EquinoxProfileService[0] IsActive 调用自:AuthorizeEndpoint 调试:IdentityServer4.Services.DefaultConsentService[0] 客户端配置为不需要同意,不需要同意 dbug:IdentityServer4.Endpoints.AuthorizeCallbackEndpoint[0] dbug:IdentityServer4.ResponseHandling.AuthorizeResponseGenerator[0] 创建混合流响应。 dbug:Equinox.Account.Repositories.PersistedGrantsRepository[0] MAbolcoMM9bi+QcW7FVOgryzkOBZXiPRZzpw4R1UAWk= 在数据库中未找到 dbug:IdentityServer4.ResponseHandling.AuthorizeResponseGenerator[0] 创建隐式流响应。 trce:IdentityServer4.Services.DefaultTokenService[0] 创建身份令牌 调试:IdentityServer4.Services.DefaultClaimsService[0] 获取主题的身份令牌声明:test@testmailid.com 和客户端:mymobileapp dbug:Equinox.Account.Services.EquinoxProfileService[0] 通过 ClaimsProviderIdentityToken 从客户端 mymobileapp 获取主题 test@testmailid.com 的个人资料,声明类型为生日、家庭名称、性别、给定名称、语言环境、中间名、姓名、昵称、图片、首选用户名、个人资料、更新时间、网站、区域信息、电子邮件、电子邮件验证 dbug:Equinox.Account.Services.EquinoxProfileService[0] 已发布声明:email、email_verified、family_name、given_name、locale、mosoid、nickname、oid、picture、preferred_username、shareid、trackingid、updated_at、userid、zoneinfo trce:IdentityServer4.Services.DefaultTokenService[0] 创建 JWT 身份令牌 trce: IdentityServer4.Endpoints.AuthorizeCallbackEndpoint[0] 身份令牌发出mymobileapp(没有名字套)/ test@testmailid.com:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1ODU5MDg5MjAsImV4cCI6MTU4NTk5NTMyMCwiaXNzIjoiaHR0cHNcdTAwM2FcdTAwMmZcdTAwMmZxYVx1MDAyZGxvZ2luXHUwMDJlZXF1aW5veFx1MDAyZWNvbSIsImF1ZCI6ImVxeG1vYmlsZWFwcCIsIm5vbmNlIjoiQ0IxXHUwMDI0OVx1MDAyM1x1MDAzZlpIUUp5N1U4IiwiaWF0IjoxNTg1OTA4OTIwLCJjXHUwMDVmaGFzaCI6InVLVWxcdTAwNW trce: IdentityServer4.Endpoints.AuthorizeCallbackEndpoint[0] 为 mymobileapp(未设置名称)/test@testmailid.com 发布的代码:swsDKcMd78uWqcuqIA3h6KEk4v3GS1Ml 信息:IdentityServer4.Endpoints.AuthorizeCallbackEndpoint[0] 授权端点响应 { SubjectId: "test@testmailid.com", ClientId: "mymobileapp", RedirectUri: "mymobileapp://oauthredirect", 范围:“openid 个人资料电子邮件offline_access” } trce: IdentityServer4.Endpoints.AuthorizeCallbackEndpoint[0] 结束授权请求。结果类型:IdentityServer4.Endpoints.Results.AuthorizeResult trce:IdentityServer4.Hosting.IdentityServerMiddleware[0] 调用结果:IdentityServer4.Endpoints.Results.AuthorizeResult dbug:IdentityServer4.Hosting.IdentityServerAuthenticationService[0] 增强 SignInContext dbug:Equinox.Account.Repositories.PersistedGrantsRepository[0] 8RotaoHQ32K7iyNlN61q0700M47i1Fx0 在数据库中找不到
更新: 我仍在努力解决这个问题。经过进一步调试,结果发现,当自定义端点“auth/apple”删除了 auth cookie 创建时,重定向发生在登录页面中 - 很明显,没有身份验证,控件进入登录页面。否则,会出现白屏。下面是代码sn-p
AuthenticationProperties props = null;
HttpContext.SignInAsync(account.Username, account.Username, props).Wait();
由于 auth cookie 可能导致白屏的原因非常令人惊讶。 如果有人可以分享任何建议,我将不胜感激?
【问题讨论】:
标签: ios iphone .net-core identityserver4 apple-sign-in