FaceBook Login with IOS - ios

So here is my quandary:
Ive been asked to build a mobile app that works just as an existing web application works. The web application uses FB login to authenticate users and I need to do the same in ios/Android. The simplest solution is to use a webview and simply view the web app within the native application. This works well until a users logs in with FB. The FB login window pops up and one can log in, but the redirect to the url fails and just a white screen is shown.
My research points me to an issue with the FBSessionDelegate, but Im not sure if that is the issue.
Ideally, Id like to use the sample Hackbook FB app and just have it redirect users to the web app after logging in, but Im a little lost on the authentication path between the two.
Any ideas or assistance is greatly appreciated.
Thanks!

Take a look at Facebook's guide?

Related

salesforce login in ios native App

I am quite new to iOS and i am trying to post something from my App on salesforce(like we share something on twitter). For that i want to first display the login screen if user is already not logged in and if user is logged in he can post on salesforce from my app. Please guide me to a tutorial or some sample code. i have done a hell lot of searching on web but didn't find any good tutorial. i have already added the SDK to my project but not able to figure out how implement all this.
Thank you.
what about this : SalesForce on iOS login without using the SalesForce Webview?
The post point to SFDC API for iPhone. May be you will found what you need.

Is it possible to call native ios Facebook login dialog from just a web page (not a web app)?

We have an ios app that uses native Facebook login just fine.
Then we also have a website (app is basically an optimized client for it) where people can login via Facebook too. When they open our website in mobile safari, they are directed to Facebook pages to authenticate there and it works, but.. it is still far from native and users have to retype credentials they often have in ios already.
So could it be possible to to somehow launch system fb authentication for just a web page (maybe using some clever URL schema?) and get granted token back to web?
Difficult way
As described here http://aaronparecki.com/articles/2012/07/29/1/oauth2-simplified#mobile-apps you could find URL scheme to trigger the native iOS app for app authorization:
fbauth://authorize?redirect_uri=[redirect_uri]&client_id=[client_id]&response_type=token
But if you call that link it's not possible to have a redirection. You could try to hack that redirection but maybe you could not find a way out.
A secure way to solve that problem is to use a SSO token to authenticate user on your App when he logs in, and next on Safari take a redirection, with a custom url to your APP, that do as bridge to FB App via Token stored in your APP. After FB authentication you can directly redirect user back to your landing page in Safari. As said by #Lego it's an alternative way to direct authenticate that could be made by going deep to custom URL used by FB.
No, it is not yet possible to directly authenticate the user via the native Facebook App, but it's possible to authenticate the user using a custom URL scheme which opens your native iOS app which then handles the authentication flow:
The user authenticates natively with your iOS App. You then store the user login (not password) in your app (i.e. using NSUserDefaults).
Then the user opens your web page in Mobile Safari. You redirect the user via a custom url scheme to your app (i.e. using myapp://authenticate). Apple documentation on implementing custom URL schemes: click
Now, if you have an active FB session in your iOS app, you can either directly redirect the user back to your landing page in Mobile Safari, passing the access token via url get parameter or you first re-authenticate the user, displaying a login view with the user name pre-filled, which you have stored in your iOS app before (step 1) and then redirect the user to your landing page, again all depending on session state and your security needs.
For opening face book app you can use Custom URL scheme. But i am not sure if u can authenticate user from it. In case if you could also then it will be confined up to the fb account which is already configured on that device app .so better try to use face book api or something
I don't get your question exactly but i think as per your question you want to create fb app Login in safari or in your custom web view.
is this perfect ?
as per my knowledge web view is different thing and native app is different thing.
if you are Login in web view then no need to check anything token or other thing because it will give you Logout thing there.
but if you are Login in your application then "developer.facebook.com" will definitely help you.
and yes, you will do most of the thing in your app as native facebook app do.
Hope it help....

what are the differences of various FB login methods?

There are three different login methods in iOS:
Login via web pop-up
Login via Safari
Login via Native App
and one more in iOS 6 - login via native pop-up controller using iOS 6 Facebook credentials.
In my case, I'm using FB comments plugin inside UIWebView and I'd like to allow user to leave comments there. For that I'm using FB login via web pop-up. Using other methods lead to the two different results:
FB comments plugin not loading at all
FB comments plugin loaded, but user is still unauthorized (login via Safari)
Whereas I have no idea, how to deal with the first one, the second one happens I think because cookies (or FB credentials) are stored in safari, but not in my App, which is required for comments plugin to understand that the user has logged in.
In this case, I'm wondering - when and where should we use each of the FB login approaches?
And what should I use in my case?
I recommend using Parse to handle social account management. It's super easy to integrate with your code and free for your purposes. Take a look. Just sign up to Parse, Create an App and follow the easy quickstart guide. They also have great documentation and forums to help you out.

iOS Facebook login stopped to work

I have native facebook app in development for few months and login worked on ios and android.
Yesterday iOS login stopped to work. Android app is able to login.
I have not changed iOS code.
I was unable to login with Facebook Native client. I have uninstalled it and I still get same page on FB website. I am redirected to following page
http://m.facebook.com/home.php?_rdr
Have someone get same problem?
Any idea what is wrong?
Thanks
Check your Facebook application ID. Mine was deleted and I've got the same problem as you have.
If you didn't change anything on your end, Facebook might have chained something with their API. Perhaps there is an issue with the OAuth or something. Have you taken a look at Facebook's developer portal to see if they have changed anything recently?
try to authenticate in a desktop browser using firebug or so and check all the http traffic and response to figure out what the problem could be

Automatic login on facebook from my site

I am working on a web application, I am using graph API with php sdk for accessing the facebook features.
I am using facebook connect and it is working fine for login, but every time a user come to my site and get login by using the login button.
I want to make this automatic, Is there any way that when users come to my site they get logged in automatically.
How can I achieve this..
anybody help please.
thanks in advance.
Danish
If the user does not explicitly authorize you to get some private data from his Facebook account (included his Facebook ID), you can not get them.
I cannot think of a way to get the Facebook ID without the authorization of the user. So no way for you to automatically log in users.
Hope that helps.
I would say that maybe you shouldn't make it to connect automatically, some viewers of your website might not be very happy that as soon as they get there they are automatically logged in with their facebook profiles, pictures, information, etc.
Also because there could be another one's facebook already connected on the same computer, but still...
My advice would be to just leave a button to login when the user wants.

Resources