Error: The client token cannot be used for this API - facebook

I am trying to publish Facebook Timeline actions using the app access token instead of the user's access token (so that I don't have to deal with expiring sessions), as described here:
https://developers.facebook.com/docs/opengraph/using-app-tokens/
This was working fine, but stopped working a few days ago, now giving me this error:
The client token cannot be used for this API
Any ideas on why this is happening, and how to fix it?

Related

Facebook graph api with app token for 60 days

I have an access token and the following url:
https://graph.facebook.com/v2.5/414950271951116?fields=posts.limit(50).until(1451606399).since(1420070400)%7Bmessage%2Ccreated_time%7D&access_token= INSERT APP TOKEN
Originally I made an app token which could make requests for 60 days. It seems that it's not working now. Is anyone else having this issue or am I doing something wrong? I don't seem to get any error messages.
it was my mistake. It seems that this particular user has blocked people from using the API on their Facebook page.

Facebook Access Token is Expired using Facebook SDK PHP

I am trying to link my application to a facebook user account but every time I go through the process of retrieving their profile I get this error:
string(140) "{
"error":{
"message":"An active access token must be used to query information about the current user.",
"type":"OAuthException",
"code":2500
}
}"
The reason I am confused is that when I initially request an access_token from facebook it return a token for me.
string(56) "access_token={app_id}|{app_secret}"
Which I am then told is expired and I don't know why.....
I understand in order to get an access token you must follow a particular workflow.
Client Requests access and permissions via SDK and Login Dialog.
User Authenticates and approves permissions
Access token returned to client
Graph API calls with short-term access token (web) or long-term access token (native mobile)
Based on what I've seen in my code, I get to step 3 but step 4 fails because the token is said to be expired. Does anyone have any idea what I can do to fix this!?
I notice that for step 1 the login dialog is never shown but I still get an access code returned despite this. Could that be something to do with it? This is the way I perform step 1.
<a class="lists" href="https://graph.facebook.com/oauth/authorize?client_id=564083793722908&redirect_uri=<?=urlencode($facebook_callback_url)?>&scope=offline_access,publish_stream,status_update">Connect a Facebook account</a>
Step 2. never seems to occur
Step 3. An access token is returned though. See above.
Step 4. Fails with the above error of expiration.
Any advice?
You cannot request user information with an app access token. You need a usser access token to do that. Your Login process needs to adhere the docs at
https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/v2.1#login
to get a user access token. Apparantly, this is not the case with your code.
Furthermore, you're only using permissions which are (long) deprecated. See
https://developers.facebook.com/docs/facebook-login/permissions/v2.1#adding
https://developers.facebook.com/docs/facebook-login/permissions/v2.1#reference

Troubles using Facebook Connect with SharePoint 2010

We are getting troubles using Facebook Connect Graph API within a SharePoint Portal, We are facning problems while getting Access_token from cookie.
before, it was gotten from cookie and It did not come encripted like 'AAAD4Ta4Jx2MBANUYTxUZCAj6vgwON1SmgUZCpyYZAFDPj9eN679kaTuG7' but one week ago the code we get comes with that extrange format and it is not possible to get info of the user.
now, we have changed the way that we get access_token bye sending the encripted code to https://graph.facebook.com/oauth/access_token?... but we always get a bad request.
Could you please indicate us. what have changed in this API recently, why did it use to work before and not now.
Facebook is now sending encrypted access tokens as part of their switch to SSL and Oauth2.0. This is mentioned on their Facebook Roadmap. They work just like normal tokens. Use that token to call /me to get the users info, as you can't parse the user id from the token anymore.

"OAuthException","message":"Error validating application."

up until 4 days ago this was working just fine, now I keep receiving an error when trying to post a youtube video on my friends (or even my own) wall.
Reading user ids from list.txt and send them a video
Posting video to user id: me
{"error":{"type":"OAuthException","message":"Error validating application."}}
I am getting the same error with an application which i created on a friends facebook account when trying to do the same thing.
Does anyone have an idea why this is and what I can do to fix it?
Thank you!
I started getting this problem for some of my users on my app recently. It was because my database field for storing oauth tokens was limited to 100 characters, which in the past has been long enough for facebook oauth tokens. Newer tokens are sometimes longer than that.
Just a guess...
I have suddenly started getting this on working code too. I have traced the API URL the PHP SDK is calling and it does have an access token in. The PHP SDK errors with 'An active access token must be used...' and calling the URL it called manually results in 'Error validating application.'

Facebook ACCESS_TOKEN used with links.getStats

links.getStats was working fine as simple REST call just few weeks ago, and right now it's failing... The reason is simple, it needs an ACCESS_TOKEN.
Of course, my application, which I use to stream some content to my wall, has an non expiring (offline usage) access token. But if I try to use this token with links.getStats I get this error: "Impersonated access tokens can only be used with the Graph API".
So my question would be: How could I get a valid ACCESS_TOKEN, that I could successfully call links.getStats?
Thanks!
We're tracking this issue internally. Here's the bug id: http://bugs.developers.facebook.net/show_bug.cgi?id=19470
The workaround solution is to use any user access token with the call. You're trying to use an app or page access token, which won't work. Go to https://developers.facebook.com/tools/explorer/ , get an access token for yourself, and tack that onto the call with &access_token=YOUR_ACCESS_TOKEN and it will work.