在 iOS 11 上,Apple 引入了一种通过 SFAuthenticationSession
在 Web 和移动应用程序之间共享身份验证数据的新方法。
向每个新用户(可能从未使用过我的网站)显示 SFAuthenticationSession
提示让他们同意然后什么也得不到并询问他们将是糟糕的用户体验登录。
documentation苹果方面很空。这是唯一的 example我找到了。
有没有办法知道在显示SFAuthenticationSession
提示符之前是否有可用的cookie?或者,在启用 Associated Domains
的情况下,当使用我的域进行身份验证时,系统不应显示提示?
最佳答案
没有。即使没有 cookie,用户也可以输入用户名/密码登录,然后在网站(例如:Facebook、Instagram)上单击“登录”/“输入”。
访问 cookie 将不会被启用:
When the webpage is presented, it runs in a separate process, so the user and web service are guaranteed that the app has no way to gain access to the user’s credentials. Instead, the app gets a unique authentication token. Official docs
Instagram-OAuth 的工作示例:https://github.com/dvdhpkns/SFAuthenticationSession-Instagram-Oauth
您添加的 GitHub 存储库是由作者发布的,用于发送有关本地服务器 cookie 共享错误的错误报告 (rdar://33418129.Original tweet)
Are cookies shared between Safari and SFAuthenticationSession? @DVDHPKNS
They’re supposed to be shared, but we have some timing bugs right now. Please do file bugs about what you’re seeing. @rmondello (Apple employee)
P.S:自您的原始发布日期以来,他们向文档中添加了更多信息。
关于ios - 有没有办法在显示 SFAuthenticationSession 提示之前知道是否有可用的 cookie,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45245918/