Search code examples
facebook-graph-apifacebook-fqlfacebook-php-sdkfacebook-access-token

Do Facebook provide the access token (at that instant) or one can get only after the friend's permission? (Using PHP Facebook-graph-API )


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.


Solution

  • 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: