问题描述:

1) I try to get an access token for my app as described in the docs:

To obtain an App Access Token, invoke the following HTTP GET request

GET https://graph.facebook.com/oauth/access_token?

client_id=YOUR_APP_ID

&client_secret=YOUR_APP_SECRET

&grant_type=client_credentials

The API will respond with a query-string formatted string of the form:

access_token=YOUR_APP_ACCESS_TOKEN

I get an access token with a strange splitter sign | as a result:

access_token=568852943149232|ah1X8cAXHKSvFrTrZ4XybG0GzR4

This seems to be in a conflict with the docs, because the first parameter is app_id (before the sign |).

2) Then I try to use the strange access_token to get friend's access tokens (it requires to make invisible test users friends):

https://graph.facebook.com/APP_ID/accounts/test-users?access_token=568852943149232|ah1X8cAXHKSvFrTrZ4XybG0GzR4

It returns:

{

"error": {

"message": "(#803) Some of the aliases you requested do not exist: APP_ID",

"type": "OAuthException",

"code": 803

}

}

If I remove the part before | (including the sign |) and make another request it returns another error:

{

"error": {

"message": "Invalid OAuth access token.",

"type": "OAuthException",

"code": 190

}

}

3) In result I need to make a 'friend' request from one user and response from another (described here):

https://graph.facebook.com/USER1_ID/friends/USER2_ID?method=post&access_token=TEST_USER_1_ACCESS_TOKEN

https://graph.facebook.com/USER2_ID/friends/USER1_ID?method=post&access_token=TEST_USER_2_ACCESS_TOKEN

I can't do that because I can't get these (users') access tokens on the step 2.

Is returning app access_token correct? If yes, how to use it?

Notice please: I make the calls from an address line of a browser, app owner in a logged-in state.

网友答案:

You need to replace APP_ID with your actual APP_ID

That's why you get this message.

{
  "error": {
    "message": "(#803) Some of the aliases you requested do not exist: APP_ID", 
    "type": "OAuthException", 
    "code": 803
  }
}

If your app id is 568852943149232 and your app token is 568852943149232|ah1X8cAXHKSvFrTrZ4XybG0GzR4 then your call is

https://graph.facebook.com/568852943149232/accounts/test-users?access_token=568852943149232|ah1X8cAXHKSvFrTrZ4XybG0GzR4

That is indeed your app token easily verifiable by https://developers.facebook.com/tools/access_token

相关阅读:
Top