已通过iPhone身份验证的用户未重定向到应用

时间:2020-04-06 16:12:40

标签: ios iphone .net-core identityserver4 apple-sign-in

我将AspNetCore 2.2.0与IdentityServer4一起使用。

问题/重现问题的步骤 我正在使用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中是否存在任何错误。根据日志,从苹果收到了回调/ connect / authorize / callback,但是它没有反映在浏览器上。非常感谢您的帮助。

日志文件的相关部分 trce:IdentityServer4.ResponseHandling.AuthorizeInteractionResponseGenerator [0] ProcessInteractionAsync dbug:Equinox.Account.Services.EquinoxProfileService [0] IsActive从以下位置调用:AuthorizeEndpoint dbug: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] 创建隐式流响应。 记录:IdentityServer4.Services.DefaultTokenService [0] 创建身份令牌 dbug:IdentityServer4.Services.DefaultClaimsService [0] 获取主题的身份令牌声明:test@testmailid.com和客户端:mymobileapp dbug:Equinox.Account.Services.EquinoxProfileService [0] 从客户mymobileapp获取名为test@testmailid.com的个人档案,并通过ClaimsProviderIdentityToken声明类型为生日,家庭名称,性别,给定名称,语言环境,中间名称,名称,昵称,图片,preferred_username,个人资料,updated_at,网站,zoneinfo,电子邮件,email_verified dbug:Equinox.Account.Services.EquinoxProfileService [0] 发出的声明:电子邮件,email_verified,family_name,给定名称,区域设置,mosoid,昵称,oid,图片,preferred_username,shareid,trackingid,updated_at,userid,zoneinfo 记录: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创建时,重定向将在登录页面中进行-很明显,如果不进行身份验证,控件将进入登录页面。否则,将出现白屏。下面是代码片段

AuthenticationProperties props = null;
HttpContext.SignInAsync(account.Username, account.Username, props).Wait();

由于身份验证cookie可能导致白屏的原因非常令人惊讶。 如果有人可以分享任何建议,我将不胜感激?

1 个答案:

答案 0 :(得分:0)

此问题已解决,由于Safari浏览器的安全性,出现了白屏。由于cookie是从appleid.apple.com创建到我的主机login.mysite.com的。尽管正在创建cookie(在charles会话中可以看到),但是进度被阻止并显示白屏。 我创建了一个间歇性的不可见表单,并将数据从我的域发布到流中,然后继续同一步骤,从而解决了该问题。 如果有人遇到“使用Apple登录”流程遇到相同的问题,请发布解决方案。

相关问题