1

I am using PHP for accessing Facebook friends location. I want to access location of all friends. I read that it requires "access tokens" to get client's public information from here

https://developers.facebook.com/docs/facebook-login/access-tokens#apptokens

and here https://www.sammyk.me/access-token-handling-best-practices-in-facebook-php-sdk-v4

Is that token will be provided by Facebook at that instant of time or my app needs to wait till friend's approval.

I saw this post on stack overflow: How to get user access token?

But i still i can't figure out what if friend is offline. How that token will be passed to my application?

Or is it like that "Tokens are generated by Facebook at time when my application made the request but i can only access the user information later using the same token if he has given permission (when he gets logged in)".?

I am unable to find any explanation regarding this.

Thanks.

Community
  • 1
  • 1
sachinmanit
  • 89
  • 10

1 Answers1

1

You can´t get the location of friends at all. Friend permissions have been removed for privacy reasons, you can only get data of users who authorized your App too. Check out the changelog for more information: https://developers.facebook.com/docs/apps/changelog

That being said, there are different Access Tokens. You can get an App Token without authorization, but you need to implement an authorization process for User or Page Tokens.

More information:

andyrandy
  • 72,880
  • 8
  • 113
  • 130
  • what about this post. http://stackoverflow.com/questions/9531595/get-friends-location-using-facebook-graph-api-hybridauth – sachinmanit May 10 '15 at 10:13
  • as i posted, check out the changelog. a LOT happened between 2012 and now. – andyrandy May 10 '15 at 11:00
  • Thanks for clearing my doubt. One more thing, can i access the friend's permanent city or country. (Not current location). Or is it the same " I can't get "? – sachinmanit May 10 '15 at 17:34
  • as i said (and as you can read in the changelog), friend permissions have been removed completely. and /me/friends only returns friends who authorized your app too. – andyrandy May 10 '15 at 17:53
  • just to make this perfectly clear: "you can only get data of users who authorized your App too" – andyrandy May 10 '15 at 17:53