Get user photo with known email address from within iOS app - facebook

I want to automatically download user's profile photo from Facebook from within iOS app when an email is provided. I'm doing it by performing search to get user id.
The app will be used by many people, so there shouldn't be logged user, eventually app should authenticate itself.
My problem is getting access_token to do that. Similar solution is implemented in the Sparrow (email client for OSX and iOS).
My guess was to acquire an access_token by making request with this url:
[NSString stringWithFormat:#"https://graph.facebook.com/oauth/access_token?client_id=%#&client_secret=%#&grant_type=search", appId, appSecret];
but in return i'm getting this:
{"error":{"message":"Missing redirect_uri parameter.","type":"OAuthException","code":191}}
anyone knows how to solve this?

You need a user access token to be able to search by email address; see Find Facebook user (url to profile page) by known email address.

Related

Can I used passport.js to login to Facebook from an app?

I and a friend are developing an app and would like to use Facebook as a way of users having their own accounts without us having to ask them to store passwords or make users for security and ease of use.
Passport.js has a facebook plugin but it talks about a redirect URL so my question is: is it actually possible to just send information like email address and password to facebook for authorisation and return the users profile without actually redirecting the user to a facebook login page.
I don't see how i could redirect the user to a facebook login while inside my app and also what on earth would i put as the callback URL? Am i just trying to use passport-facebook in the wrong way?
is it actually possible to just send information like email address and password to facebook for authorisation
No. Users are strongly discouraged from giving this information to any 3rd party app, and you are not allowed to ask users for them.
Login with username/email and password happens on Facebook, not in your app. You will get feedback from the login endpoint then that they logged in successfully.

How to get the fb and g+ email programmatically in ios?

I have integrated fb and g+ login for my ios app. and If phone already sign in with the fb its automatically log in when click the fb button. But I want to send the email of the user in fb and g+ to the server separately. Can anybody tell me how can I get the email from fb and g+ both.
Thank you
You won't get any user data (profile, birthday, email, etc.) without requesting specific permission from the user. It's a matter of following the SDK guide really.
You can request a user's information by making a me request. And you can do this in two ways:
Using the FBRequestConnection startWithGraphPath:completionHandler: method, like you did in the requesting permissions section, and setting the path to me.
Using the FBRequestConnection startForMeWithCompletionHandler: method, which will make a me request directly.
https://developers.facebook.com/docs/ios/graph
It's hard stuff that you will need to go through as a developer. Following how others did it by code will help you. But reading through the SDK guide will make you understand better.

Sign Up with Facebook and Twitter SDK for iOS

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?
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?

Facebook API returning ID instead of email

I'm making a game in unity and was using a facebook connect plugin by prime31. Previously I was acquiring the Facebook user's email adress but now when I call that I get the Facebook ID.
I checked it with https://developers.facebook.com/tools/explorer/?method=GET&path=me%3Ffields%3Demail and it returns the Facebook ID.
Has Facebook recently changed something? Can you guys tell me how should I retrieve the email address now?
Thanks.
That's the correct call - make sure you have the email Permission ( A call to /me/permissions will verify) and the user actually has an email address listed - it's possible a very small number do not.

Facebook app without prompted authentication

I've been trying to figure out a way to have my iframe Facebook app (built in PHP) work without requiring separate authentication methods. I am already logged into Facebook, but for some reason I still see all these Oauth notices from the example in the PHP SDK.
The only data I need is publicly available even without them "adding" my app. I am looking to collect their Facebook ID (since this is a contest, we need a unique ID for tracking), their name and (optionally) their email address as well.
The problem is, I cannot use the API to fetch the public information unless I already know their Facebook username. Any ideas on how I might be able to get their logged-in username or public handle so I can then fetch the rest of the information?
For whatever reason, Oauth is driving me completely insane with Facebook today.
Sidenote:
I did manage to technically get the Javascript SDK operational, which fed some information to PHP for use. The only issue there is that once I login, I don't see the data. If I refresh...then it shows up. Unsure why the refresh is required, as I wouldn't expect a user to actually have to hit refresh in order to proceed with the app.
I guess you are a bit confused here, Facebook will NOT share the username, id, full name or email without the user explicitly authorizing/allowing your application (and in the case of the email, requesting the email permission!).
Read the official Canvas Tutorial for more information:
In order to gain access to all the user information available to your
app by default (like the user's Facebook ID), the user must authorize
your app.