-1

THIS IS NOT RELATED TO JS SDK

I am building an android app that authenticates via FB on the phone, and sends the users fb_id and fb_access_token to the server. On the server I have the app_id and app_secret obtained from facebook.

When I try:

https://graph.facebook.com/me?access_token=ACCESS_TOKEN

It returns only name and ID.

Even if I add a field key, it still just return id and name.

https://graph.facebook.com/me?fields=id,name,email&access_token=ACCESS_TOKEN

Do I need to add the app_id somewhere, or is that baked into the access_token? How can I retreive the users profile information (I have just basic profile permissions), without using an SDK, just a raw URL request?

THIS IS NOT RELATED TO JS SDK

Peter R
  • 3,185
  • 23
  • 43
  • @CBroe, THIS IS NOT ABOUT JS SDK, that linked question has NOTHING to do with this question. – Peter R Apr 19 '16 at 10:29
  • Well that was impossible to tell from your _original_ question. (And that you need to ask for the fields you want, is totally independent of which SDK you are using, or if any – that is just a matter of basic API usage.) // You of course need to ask the user for the email permission, did you do that? – CBroe Apr 19 '16 at 10:56
  • @CBroe Impossible to tell? The title literally states: "Without using a SDK (no JS or PHP)". My update did NOT change the title, I only added that I had tried to add ```fields``` to the URL. Yes have auth for basic profile info. Usually SDK's add extra information to the URL so you can say something like: ```fb_sdk.getUserInfo(token)``` and the SDK will add additional info to the url query. My question is: Most SDK return a hash with user info, given a token. What URL do they use to access it, and what do they add to the query string to get it. clearly not just fields, and access_token – Peter R Apr 19 '16 at 11:47
  • Again, that you need to ask for the fields you want is completely independent from what SDK you use, or if any. And since your question in its original version did not give any clue as to that your problem might be more than that (missing permission), it simply _doesn’t matter_ if you write “no SDK” in the title or not – that you simply need to use the `fields` parameter to request the fields you want, is the same whether you use SDK X, or make API requests manually/any other way. – CBroe Apr 19 '16 at 12:44
  • _“My question is: Most SDK return a hash with user info, given a token. What URL do they use to access it, and what do they add to the query string to get it. clearly not just fields, and access_token”_ – PHP and JS SDK would not return any more fields, if you just make a `/me` request using them – additional fields have to be asked for, and the exact same way as with a normal API request. And the answer to the _duplicate_ explains that already, plus links to the documentation if you need more info about it. – CBroe Apr 19 '16 at 12:45
  • _“Yes have auth for basic profile info”_ – basic profile does not include email; so – you need to ask the user for the `email` permission. – CBroe Apr 19 '16 at 12:46

1 Answers1

0

Try this ;)

This endpoint by default return these two fields to get more fields you need to specify those fields in the url like this:

https://graph.facebook.com/me?access_token=ACCESS_TOKEN&fields=id,name,email

Find all available fields Here User Object

itzmukeshy7
  • 2,669
  • 1
  • 21
  • 29
  • I have tried this, but still only returns id and name, no email. – Peter R Apr 19 '16 at 10:31
  • For other fields expect name and id you need to specify those fields in the access token fields parameter that you want to access those fields too likes email, bio etc. – itzmukeshy7 Apr 19 '16 at 10:33