I have read this: trying to get app access token
And it doesn't work... I'm getting the following error:
"error": {
"message": "An active access token must be used to query
information about the current user.",
"type": "OAuthException",
"code": 2500
}
I need the app access token in order to create open graph objects that are owned by the application. I know how to create objects owned by the users, but I just cant find the correct way of creating the App access token.
AppId -> doesn't work... AppId|AppSecret -> doesn't work.... App ClientToken -> doesn't work....
Anyone know this?
At a high level, you obtain a long-lived token for the client by: Using a valid, long-lived access token, your server sends a request to get a code from Facebook. Facebook sends a code back to your server and you securely send this code to the client.
To access the Manage App Tokens page, or view app tokens: In the App bar, select the app you want, click Settings, then click App properties. Click Advanced settings to expand the section, if needed. In Security options, find the Require Application Tokens checkbox.
An access token is an opaque string that identifies a user, app, or Page and can be used by the app to make graph API calls. When someone connects with an app using Facebook Login and approves the request for permissions, the app obtains an access token that provides temporary, secure access to Facebook APIs.
You can simply request https://graph.facebook.com/me?access_token=xxxxxxxxxxxxxxxxx if you get an error, the token is invalid. If you get a JSON object with an id property then it is valid. Unfortunately this will only tell you if your token is valid, not if it came from your app.
You can get it directly from the Access Token Tool.
Please note: For security, app access token should never be hard-coded into client-side code, doing so would give everyone who loaded your webpage or decompiled your app full access to your app secret, and therefore the ability to modify your app. This implies that most of the time, you will be using app access tokens only in server to server calls.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With