post to pages not works after turns app public - facebook

i wrote a very simple function that send some text to a fb app that just post the sended text as post as page where im the admin too.
im using a plugin for laravel that use the longterm fb token as authorization for publish.
unitll now everything works nice, but the post was visible just to me due the developing mode on the app. Today I turn it as pubblic, but i dont works anymore! thats is the error message raised by my plugin:
Exception {#323 ▼
#message: "Graph returned an error: (#200) Requires either publish_to_groups permission and app being installed in the group, or manage_pages and publish_pages as an admin ▶"
#code: 0
#file: "/home/natty/workspace/speechToTextStories/vendor/toolkito/larasap/src/Facebook/Api.php"
#line: 69
trace: {▶}
}
i didnt change anything on my code, and the "long term token" is still good as fb's debugger says. Maybe I touch something on the settings page of the app, but after i try to put again as before...but no results still erros.
On settings i got:
publish_pages
publish_to_groups
manage_pages

Related

How to inspect/debug an Instagram Basic Display API token

When linking with the Instagram Basic Display, our app asks for the user_profile and user_media scopes. When linking, the user can de-select the user_media scope, which defeats the purpose of linking with our app.
I'd like to validate that the user has granted the user_media permissions, but can't figure out a good way to do it.
The Facebook Access Token Debugger is able to display the scopes that were granted when I paste in an IG Basic token.
I've tried using the /debug_token endpoint from the Graph API. It lets me debug Facebook and IG Graph tokens, but not IG Basic:
GET /debug_token?input_token=<token-to-debug>&access_token=<app-access-token>
The "app-access-token" I'm supplying is my Instagram Basic Display app's ID and secret combined together like this: app-id|app-secret
When I do this I get an error saying:
Error validating application. Cannot get application info due to a system error.
The only thing I can think of doing is to try accessing the user's IG media and detecting if it fails w/a permissions error. I'd like to avoid doing this if there is a better way :)
I ended up verifying this with an api request that tries to fetch the last media posted by the user:
(Ruby)
def validate_permissions
params = { access_token: token, fields: ['id'], limit: 1 }
get('https://graph.instagram.com/me/media', params)
end
The get method in this class has an error handler for when the HTTP status >= 400. In the error handler, if the HTTP status is a 403 and the error has a "code" of 190 then we can conclude the user has not granted the permission.
The error message in this scenario is:
Application does not have permission for this action (access user media)

Facebook API error code 190, subcode 460 in Meteor app even after refreshing login

I use accounts-facebook in Meteor 1.4.3.2 to allow my app's users to log in via Facebook. The app also makes other Facebook API calls using the Facebook token accounts-facebook stores in the user document.
Sometimes, when I try to make a call, I get an error:
{
message: 'Error validating access token: Session does not match current stored session. This may be because the user changed the password since the time the session was created or Facebook has changed the session for security reasons.',
type: 'OAuthException',
code: 190,
error_subcode: 460,
fbtrace_id: '...'
}
Facebook says users will need to log in again. I built a flow to fix this problem. When we get a 190/460, we set the services.facebook.accessToken property in their user document to false and email them a link to a page with a "Refresh Facebook Login" button which simply logs them in to the app again via Facebook.
The flow appears to work. I can see the accessToken gets set to false. When I click through on the link in the email and then click the "Refresh" button, I get a token that is different from the previous token. However, when the app tries to make another FB API request, it gets the same 190/460 error with the new token.
If the fix for 190/460 is to have the user log in again, why do I continue to get the error after the user has refreshed the token?
I had a similar issue and solved it going to Facebook developer page
-> Messenger option from the left menu
-> Configuration
then scroll to "access tokens", click "generate token" button and copy that token to your code.
For example in php looks like
$accessToken = 'EAAKHOkhtsDABAJgyp....';

Desktop AIR app and Facebook login

I try using this lib https://code.google.com/p/facebook-actionscript-api/,
but when I call FacebookDesktop.init("820024968051122",loginHandler);
I get error:
code: 2500
message: An active access token must be used to query information about the current user.
type: OAuthException
If I call FacebookDesktop.init("820024968051122",loginHandler,"test_user_token");
then all work fine, but where I get token if user is not log in?
Well buddy, you can read the documentation, where you can see that under init there is login method, stating: [static] Opens a new login window so the current user can log in to Facebook.

Posting on user's timeline on the behalf of the user

I created and APP on the Facebook.
Now I am trying to post a comment on the user's timeline using the Graph API but I cannot undestand what I need to do.
I already authorized the Application (I authorized this permissions: 'user_status,publish_stream,user_photos,email').
If I look on my profile -> privacy I can see that the APP can:
This app can: Post on your behalf
This app may post on your behalf, including status updates, photos and more.
Last data access:
Basic InformationToday
See details · Learn more
Posts on your behalf:
Who can see posts this app makes for you on your Facebook timeline?
Public
Notifications:
When to notify you?
The app sends you a notification
So this part seems OK.
On my application I do the following to try to post somenthing on my timeline (I need to post it when I am off line).
1) GET : https://graph.facebook.com/oauth/access_token?client_id=APPID&client_secret=*APP_SECRET*&grant_type=client_credentials
RESPONSE:
access_token = 422828347771671|UdQELQIf0N7krF4JUo7VwtPLTkk
2) GET: https://graph.facebook.com/search?q=myemail&type=user
RESPONSE:
_"error":_{
______"message":_"A_user_access_token_is_required_to_request_this_resource_",
______"type":_"OAuthException",
______"code":_102
___}
But reading the documentation (https://developers.facebook.com/docs/reference/api/#searching) it seems that this request does not need any kind of access token.
I also tried to add the access token, but the result is still the same.
3) I know my facebookid so I tried to use it directly:
POST: https://graph.facebook.com/100001139132403/feed
ARGUMENT:
access_token=422828347771671|UdQELQIf0N7krF4JUo7VwtPLTkk,
message=Hello
RESPONSE:
"error": {
"message": "(#200) This API call requires a valid app_id.",
"type": "OAuthException",
"code": 200
}
}
So I tried to add client_id=APPID and app_id=APPID, I tried to put one, the other and also both arguments as GET or POST but nothing changed.
I checked the APPId ad it is correct.
Do someone have any idea?
Thank you!
You cant simply generate a user access_token by querying to a URL. What you did gives the App access token and as the error say, you are trying to do something, that needs user access_token.
Refer and implement this : https://developers.facebook.com/docs/howtos/login/server-side-login/
And use that access_token for the rest of the processes.

iphone twitter and sharing

Has anyone encountered the following error message when sending to Twitter?
"Error: Incorrect signature"
And on the debug console:
<0xf14cf80 SHKTwitter.m:(356)> Twitter Send Status Error: {"request":"\/1\/statuses\/update.json","error":"Incorrect signature"}
So far as I can tell I've followed the install instructions on http://www.getsharekit.com/install/#download and it is working with Facebook, e-mail etc. just not Twitter.
It would be great if someone has seen this error before and goes "aha!".
All I did to enable twitter Sharing is:
Regitered my App as a Twitter APP (Application Type: Browser)
#define SHKTwitterConsumerKey #"My..."
#define SHKTwitterSecret #"My..."
#define SHKTwitterCallbackUrl #"http://www.anything.com/callback" // You need to set this if using OAuth, see note above (xAuth users can skip it)
\#define SHKTwitterUseXAuth 0 // To use xAuth, set to 1
\#define SHKTwitterUsername #"" // Enter your app's twitter account if you'dlike to ask the user to follow it when logging in. (Only for xAuth)
Note that for the callback function you can enter any URL you want. even www.google.com. Just make sure it is the same URL in your code.
The issue is that you're signed into your twitter account, and allowed the app to connect to your profile.
However, days go by, the Key and Secret change, and now you're seeing this error. It's because you have to log out and re-log back into Twitter. I spent waaay too much time finding this out when I created a new Twitter App to hook into (and organize my apps) and found this error.
Basically, ShareKit is saving your login info, auto-logging you in, and getting the error when twitter says the app doesn't have permission to connect to your profile.
Follow these steps to log yourself out and test again :
http://www.getsharekit.com/docs/#logout
Check this previous SO question, it might be able to help you solve the problem:
Twitter API status update always returns "Incorrect signature"