facebook sdk once-only login webapp - facebook

Hi I have a question for the facebook javascript sdk. Is it possible, and if yes how, that the user login only one time and then the user is always logged in instead of every application start go on the login button again? I try to make a webapp and run it with webview in android. Any apps have that function e.g. draw something.

That´s what FB.getLoginStatus is for, it checks if the user authorized your App already and refreshes the Token: https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/
More information: http://www.devils-heaven.com/facebook-javascript-sdk-login/

Related

How to implement facebook login with strapi in ionic

I am wondering how to implement facebook login with strapi in ionic.
My question is: I have a button that will go trough http://localhost:1337/connect/facebook and it should be opening the facebook app on my phone. Once I log in how do go back automatically on the app with the users information? I have seen that it stores on the db but I am missing something on how to go back to application.
Thanks
Once the user presses the login button, your app will redirect him to connect/facebook.
Which will open Facebook for login in and after facebook will respond with code in URL to the URL that you set in Strapi provider configurations.
So you should handle the response in your frontend, take that code and send it to http://localhost:1337/auth/:provider URL of the backend, which will respond to you with user data.
Hope it'll work fine for you.

Mobile Website Facebook Login using Facebook App for login details

Using a web browser e.g. Chrome on Android, if a mobile website requires a user to be logged in to Facebook and they are not, the browser will ask for Login details even though the phone may be logged in to Facebook via the Facebook native App. Is there any way to get details from the Facebook App without the user having to log in again?
If you want to login in website in a browser, using Facebook account from Facebook app - it is impossible, without intermediary application, or service. And even with it, I don't think, that you can get user login data.
Other approach - is try to launch Facebook app from your site, and show site from it, but again, you can't login to it, using app.
Why? Because the app, holds only token data, and nothing more. You can't get other information, like password, or email. Also, the work of browser, that save cookies and the app, that save token is different. You can't connect them together.
Clearly speaking it is not possible using website in browser.
Even it is also not possible if you develop any android app, the reason is that the facebook app will not share any data to any other app (even if it is running on the same device).
I also don't think that launching the facebook app from browser will be feasible for you, as you just want to use the facebook login system and then want the users back on your website (and again facebokk will not send any data to your web or app even if it is launched from your web or app).
I think it's not possible, because we wont link browser and an app.
I developed one android app with facebook login integration.If facebook native app already logged in, now i click my app facebook login button it directly redirect my app to my home page without asking fb username and password.
For me i used localStorage in javascript
localStorage.setItem("userName", userName);
localStorage.setItem("password", password);
var uname=localStorage.getItem('userName');
var pass=localStorage.getItem('password');

display facebook page dialog with ios sdk

I'm working with ios, and I'm trying to show a facebook page to let user like it.
There is a dialog method in facebook ios sdk
[facebook dialog: andDelegate:]
But i can't use this method, because there are "feed","oauth" methods only.
Is there any function to show facebook page with a dialog?
I guess there isn't.
So the second try is this : Sign in with Webview, and show user the page.
This has a problem too. i can't sign in facebook via webview with user's access token.
i've done signin with "[facebook authorize:fbPermissions]" method, but this never share the cookie with my UIWebView.
Can I sign in facebook via webview, with user's access token?
And more try, I thought like this.
If i sign in with UIWebView first, and save access token in my server and my iphone, I could use this for ios sdk.
Is this possible?
Please help me. I didn't sleep for a long time.
Thanks.

Utilize the Facebook SDK Login (iOs/Android) for being logged into Facebook # Web?

Straight Forward:
User logs into my iPhone/Android App with Facebook SDK [so i got an id and authtoken for that user]
... functionality using the FB SDK and much more ...
I open a WebView inside my pp and load the facebook profile of an other user, but in this webview im NOT logged in.
Is there a possibility, to utilize my login (id/authtoken) from the SDK to get the user automatically logged in inside the webview?
TIA
On iOS you can use single sign on, see https://github.com/facebook/facebook-ios-sdk, scroll down to 'Single Sign On' section with it's description.
This is not a direct solution but perhaps it could help.

iOS - being logged-in in a webView after logging in with the SDK

I'm building an iPhone app that has some social features. I've managed to get the user to log-in to Facebook within my application.
I've also implemented a webview that loads a facebook iPhone-optimized page. What I now want to do is my user to be logged-in within the webview without having to log-in twice (once in the app and once in the webview)
I've tried a few things playing around with the access_token in the URL but it didn't work.
Does anyone know if it is possible to implement that and how to do it?
Thanks in advance for your help
Short answer: You're probably not supposed to be able to do that.
The idea is that your app should only store an authentication token that lets you do stuff as your app (e.g. post to the wall as your app). On the web version, the user is logged in to facebook and facebook additionally passes an authentication token to your website; on the iOS version, I think you never get the Facebook session cookie, and I'm pretty sure you need the Facebook session cookie to be logged in to the web side of things (especially since it's designed for the browser — logging out of Facebook logs you out of Facebook Connect on all sites).
There are loads of things you can do to work around this — it's trivial to just ask the user for a username/password (and the whole idea of a "trusted UI" inside a UIWebView inside your app is flawed, despite Facebook's claims).
The "right" thing to do is to implement everything using calls to the iOS SDK so you don't have to bother with the web side of things.
were you testing your app on the simulator or on the device? The reason i ask is because im trying to get the app to stayed logged into fb which it does, sorta...it still pops a fb dialog saying it logged in fine and the user has to click on an OK button.
I havent had time to test it on the device but i think it may have to do with the fact that with the OAuth 2.0, with 3.2.x or >...if the fb is installed, it uses the fb-app login but if its not installed it uses the safari web login.
Since simulator doesnt have the fb app installed, it actually uses the safari web login (i humbly deduced) which would otherwise store a cookie and maybe it doesnt do so on the simulator..dunno, im still looking for the answer on that one :)