5

I am trying to add Facebook and Twitter login and sign up in my iOS app. As my App is server based, I need to create a user profile on my DataBase as well. But the problem is that I cannot fetch passwords from Facebook and Twitter for obvious reasons. So I am not sure how to go about it. What should be used as a password for the new profiles that are created, and then log the users in as well.

What have people done in past to create profiles on their databases by fetching information from Facebook and Twitter?

I want to save the Email address, Name, Location, Interests, and then also a password. What should be the right way of going about it?

Jonathan
  • 2,728
  • 10
  • 43
  • 73

1 Answers1

5

You can't access that information of course. The way it works is Facebook or Twitter sending you a response saying "Yes, credentials are OK for user XXXXXX" Or "No, bad credentials". Then you can save the user's ID to your database.

You will never get any other info unless you ask for permissions.

https://developers.facebook.com/docs/concepts/login/

https://dev.twitter.com/docs/auth/sign-twitter

To ask permissions, you will have to create an app.

How to ask for permission in facebook application?

Community
  • 1
  • 1
JoRouss
  • 2,864
  • 2
  • 22
  • 40
  • JoRousss, I did gather that once I read the documentation. But once I create a user profile in my database using name,emails,etc. Based on that, I can easily assign the user a username, but what about password? should I make the password the access token? Is it device independent until it expires? – Jonathan Apr 16 '13 at 15:03
  • You can't set a password, you have to get the user to log in using facebook again – JoRouss Apr 16 '13 at 15:06
  • 1
    There must be a unique user ID you can save so you know the same user logged in again – JoRouss Apr 16 '13 at 15:08
  • JoRouss, but I also need to create a user profile on my Database, and since authentication of the user profile at my database requires a password, I am not sure how to get around that situation – Jonathan Apr 17 '13 at 04:48
  • Forget the password, let Facebook tell you if the user is logged in or not – JoRouss Apr 17 '13 at 14:03
  • Somebody, I will try to implement this. But I am still having troubles grasping the concept. can you please maybe share an ios 6 FB/Twitter integration example with me? or maybe a tutorial that I can probably look into? – Jonathan Apr 22 '13 at 09:02
  • 1
    I don't have such a project at home. The concept is : you don't bother about the credentials stuff, you let facebook take care of it. You accossiate your profile info with the unique user ID facebook will return you once the user is logged in (will always be the same). So you know the 2 essensial things, is he connected, and who is he. – JoRouss Apr 22 '13 at 13:35
  • @Jonathan You can download the [FacebookSDK](https://developers.facebook.com/resources/facebook-ios-sdk-3.5.pkg) and look at the Scrumptious example. – Michael Reneer Apr 22 '13 at 23:00
  • I would also add that some of the items you want, like [Email](https://developers.facebook.com/docs/reference/login/email-permissions/) require extended permissions. – Michael Reneer Apr 22 '13 at 23:02
  • @MichaelKellyReneer for iOS 6 we do not need to download Facebook SDK anymore – Jonathan Apr 22 '13 at 23:20
  • That is not true, please refer to the Getting Started [documentation](https://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/). – Michael Reneer Apr 22 '13 at 23:25