Facebook iOS 9 SDK 登录重定向到 Safari 上的 mbasic.facebook.com

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37008596/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 08:59:32  来源:igfitidea点击:

Facebook iOS 9 SDK login redirects to mbasic.facebook.com on Safari

iosfacebookfacebook-graph-apisafari

提问by Harry Wang

I'm using the iOS 9 Facebook SDKto manage login. Prior to iOS 9, the process worked perfectly. It worked like this:

我正在使用iOS 9 Facebook SDK来管理登录。在iOS 9之前,该过程运行良好。它是这样工作的:

1) user taps on the Log In Via Facebookbutton on my app
2) user gets redirected to the Facebook app if the app is installed, otherwise redirected to Facebook's page on Safari
3) user authorizes my app's access to his/her Facebookcredentials and redirects back to my app to complete login

1) 用户点击Log In Via Facebook我的应用程序上的按钮
2) 如果安装了该应用程序,用户将被重定向到 Facebook 应用程序,否则重定向到Safari上的 Facebook 页面
3) 用户授权我的应用程序访问他/她的Facebook凭据并重定向回我的应用程序完成登录

However in iOS 9, according to this SO postthe default behavior is that in step 2), user will be redirected to his/her Facebook page on Safari instead. This behavior causes the following issue that's quite frustrating:

但是,在 iOS 9 中,根据此 SO 帖子,默认行为是在步骤 2) 中,用户将被重定向到他/她在 Safari 上的 Facebook 页面。此行为会导致以下令人非常沮丧的问题:

A particular user has his/her Facebookpage defaulted to mbasic.facebook.com, and when the user clicks on Log In Via Facebookon my app, it opens up Safariunder the mbasic.facebook.comURL, and it shows the user's Facebook Homeview with activity feeds rather than the app authorization page where the user can authorize my app. In this case, the user would have to:
1) Log out of his/her Facebookaccount;
2) Open my app, and click on the Log In Via Facebookbutton;
3) Safariopens up facebook.com and user will need to first log in his/her Facebook account and then authorize my app

特定用户的Facebook页面默认为mbasic.facebook.com,当用户点击Log In Via Facebook我的应用程序时,它会在URL下打开Safarimbasic.facebook.com,并显示用户的Facebook 主页视图和活动源,而不是用户所在的应用程序授权页面可以授权我的应用程序。在这种情况下,用户必须:
1) 退出他/她的Facebook帐户;
2) 打开我的应用程序,然后单击Log In Via Facebook按钮;
3) Safari打开 facebook.com,用户需要先登录他/她的 Facebook 帐户,然后授权我的应用程序

This is A LOT to ask from the user. My question are:
1) How did the user get defaulted to the mbasic.facebook.com page instead of facebook.com?
2) Is there anything that we can do in the Facebook iOS 9 SDKsetting to override this redirect to mbasic.facebook.comand instead have it redirect to facebook.com like before?

这对用户提出了很多要求。我的问题是:
1) 用户是如何默认使用 mbasic.facebook.com 页面而不是 facebook.com 的?
2)我们可以在Facebook iOS 9 SDK设置中做些什么来覆盖此重定向mbasic.facebook.com,而是像以前一样将其重定向到 facebook.com?

回答by Harry Wang

Turns out if the user does not have JavaScript enabled on mobile Safari, Facebook will redirect you to the mbasic.facebook.com site and prevent the user from logging in to your app via Facebook. There's probably not much we can do with the Facebook iOS SDK to override that. We'll just have to remind the user to enable JavaScript on Safari.

事实证明,如果用户没有在移动 Safari 上启用 JavaScript,Facebook 会将您重定向到 mbasic.facebook.com 站点并阻止用户通过 Facebook 登录到您的应用程序。我们可能无法用 Facebook iOS SDK 来覆盖它。我们只需要提醒用户在 Safari 上启用 JavaScript。