Facebook ID

carloz

Member
Licensed User
Longtime User
Hi all,

have been looking at outh lib and the status via app code...
i have made a app which lets the user know when he is near a particular location, i am able to launch the facebook page "m.facebook.com" , the user logs in.. now i need to retrive his facebook id..

can anyone plz point me in the right direction on how to do that?

regards
carloz
 

admac231

Active Member
Licensed User
Longtime User
This is much easier than you think!

First, have a look here: http://www.b4x.com/forum/basic4android-getting-started-tutorials/14576-oauth-facebook-feeds.html

Follow what stevel05 says about creating an app on Facebook.

Then using his example program, you only really have to change a few things:

  1. The parameters at the beginning (app id, secret e.t.c)
  2. The data request link. For the users ID you need to use https://graph.facebook.com/me. It's all documented in the Facebook graph docs
  3. The fields (in the GetFeeds sub). You want id so fields="&fields=id"
  4. How the JSON response is parsed

I have attached a working version of this but please try to follow it and do it on your own first. Copying and pasting teaches nothing!
 

Attachments

  • FacebookID.zip
    9.6 KB · Views: 350
Upvote 0

carloz

Member
Licensed User
Longtime User
hi,

thnx erel and admac231...i did look up steves post and was doing exactly the same..but couldnt get it to work...

i tried admacs file too and it too wasnt giving me the id... just figured where i was going wrong !!!

the redirecturi was RedirectUri="http://www.chronicles.co.in" , while the if condition was If Url.StartsWith(RedirectUri&"#access_token=") ..all i was missing was a slash "/" in my redirecturi :BangHead:

spent the whole day trying to figure this out ...thnx again

regards
carloz
 
Upvote 0
Top