Native Facebook Login experience via browser

99封情书 提交于 2019-12-23 07:59:35

问题


I have seen several flavours of this question going around but nothing exactly specific nor answered so trying it myself.

I am trying to build a Facebook login experience via the browser into my Facebook-based app that will require the users to not remember their passwords as much as possible. This means that if

  • they log in via their desktop browser and are already logged in, it will only ask them to 'OK' the permissions
  • they log in from their mobile browser and are logged in via their respective native app (Android/iOS), it will simply redirect them to the native app, ask for the app permissions and redirect them back to the success page on the browser
  • they log in from any browser and are not currently logged onto Facebook in any form, they have to enter their password and authenticate (whether natively or via browser this does not matter)

I know how the first can be done - that is pretty straightforward using the JS SDK. The second point is the tougher bit.

I am aware of existing custom URL schemes for Android and iOS but nothing specifically really mentions how that can be used for authentication and/or authorisation of Facebook apps. Does anyone have any ideas on how this can be done?

Thanks!


回答1:


In iOS use iOS facebook SDK. It will handle the login process effectively in different situations depending on the resources available. Check out this answer to know about different login flows

Integrating facebook




回答2:


You're looking for Single Sign On behavior- in Facebook, use the native SDK, and instructions for setting up SSO. It includes entering your bundle id in the settings and setting up a referring url name (the name of your app usually). So what happens is- if you launch safari mobile, and log into facebook. Then, launch your app, with good integrated SSO. Then, it won't require you to login/pass, because it knows you've authenticated via browser. Same with Android.




回答3:


I think what you are looking for (at least for Android) is starting an Intent on certain schema that will open Facebook app.

This is answered here Android facebook intent to show profile with class com.facebook.katana.ProfileTabHostActivity doesn't work any more



来源:https://stackoverflow.com/questions/20943499/native-facebook-login-experience-via-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!