[英]display facebook login through native app or web browser on ios using javascript
im creating an ios app using appgyver and steroids using HTML/javascript 即时通讯使用appgyver和类固醇使用HTML / javascript创建ios应用
Im able to display and login the user to facebook using this method 我无法使用此方法显示用户并将其登录到Facebook
window.location.href = 'https://www.facebook.com/dialog/oauth?client_id=XXX&redirect_uri=http://localhost/views/appdir/facebook.html&scope=email,read_friendlists'
what this does is open the facebook login page in my app. 这是在我的应用程序中打开Facebook登录页面。
what i would like is instead of this when the user clicks the login button it opens the login screen on the native facebook app then redirects back to my app after user has logged in. 当用户单击登录按钮时,我想代替的是它会在本地Facebook应用程序上打开登录屏幕,然后在用户登录后重定向回我的应用程序。
or if the native facebook app does not exist then it opens the facebook login page in the web browser(eg safari) then redirects back to my app after the user logs in. 或者如果不存在本机Facebook应用程序,则它将在Web浏览器(例如safari)中打开Facebook登录页面,然后在用户登录后重定向回我的应用程序。
the reason yi want this is becuase when it opens the facebook login page in my app there is no option for the user to cancel the login and return back to the previous page. yi之所以希望这样做是因为,当它在我的应用程序中打开facebook登录页面时,用户无法取消登录并返回上一页。 also if the user clicks on the link 'click here to download the facebook app to your phone' then the user gets redirected to the appstore and leaves my app with just a blank white page in which it cannot recover and my app has to be restarted.
同样,如果用户单击链接“单击此处将facebook应用程序下载到您的手机”,那么该用户将被重定向到应用程序商店,而我的应用程序只有空白的空白页面,无法恢复,因此我的应用程序必须重新启动。
if its possible to do either of the two that i asked it would be great or if there is some other soloution would be great also. 如果有可能同时执行我要求的两个操作,那将是一件好事,或者是否有其他的解决方案也将是一件好事。
Try Cordova Facebook Plugin . 尝试Cordova Facebook插件 。 It uses the native Facebook app for login and, if it's not available, it will use the standard dialog based authentication.
它使用本机Facebook应用程序进行登录,如果不可用,它将使用基于标准对话框的身份验证。 Here are the instructions how to set it up with AppGyver Steroids.
以下是如何使用AppGyver Steroids进行设置的说明。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.