简体   繁体   English

使用javascript在iOS上通过本机应用程序或Web浏览器显示Facebook登录

[英]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.

相关问题 Facebook登录无法使用iOS应用内浏览器 - Facebook login is not working In-app browser for iOS Facebook Javascript登录本机ios6 UIWebView(WORKS ON SAFARI) - Facebook Javascript login in native ios6 UIWebView (WORKS ON SAFARI) 在浏览器或本机应用程序中正确打开Facebook页面链接IOS cordova - Open facebook page link in browser or native app correctly IOS cordova Facebook在Web应用程序中登录 - Facebook login in a web app Facebook 登录在应用浏览器中的 Andriod Facebook 中不起作用 - Facebook login is not working in Andriod Facebook in app browser 使用Javascript登录Facebook - Facebook login using Javascript 通过使用javascript自身在Web浏览器中模拟运行javascript的方法 - Way to simulate running javascript in web browser through using javascript itself 本机iOS应用程序可与基于JavaScript的Web服务交互 - Native iOS app to interface with javascript based web service 使用Javascript SDK的Facebook应用程序上的无限登录循环 - Infinite login loop on Facebook app using Javascript SDK 从网络应用程序调用FB.login()时,官方的Facebook iOS应用程序总是崩溃 - Official Facebook iOS app always crashes when calling FB.login() from web app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM