I´m using API Grapgh Facebook trying to Post in the Wall of a {User-id}.
I use this:
POST /v2.3/{user-id}/feed HTTP/1.1
Host: graph.facebook.com
message=This+is+a+test+message
with the token for the application.
It returns "(#200) The user hasn't authorized the application to perform this action" but the user-id has permission "publish_actions".
I don't know why I have not permission
You cannot post to another user's wall without their permissions to your app.
Post on your wall with user access token, tag your friend see example here
Related
I'm using the Facebook Live Video API for testing purpose.
I've created a Test User, associated with my Facebook App, with the following permissions: publish_actions, user_videos, publish_pages, manage_pages
Using graph API explorer, I can make a POST request on /{user_id}/live_videos, using the Test User ID and Access Token (got it from the My App -> Role -> Test Users).
But, if I create a page with the Test User (logged in with its email), POST resquest on /{page_id}/live_videos, with the test user page ID and Page Access Token with required permissions, I get an error:
"message": "(#100) No permission to perform current operation.",
"type": "OAuthException",
"code": 100,
I have the exact same issue when I'm not using a Test User, i.e. when I try to post live videos on a page id with an admin page token, while it works on its user id with user access token.
I've followed these documentation:
Live Video API
Why can't I POST live_videos on page ID with a page access token while it works on user ID with user access token?
Best regards.
Nico
POSTing a live_video with the page access token should work now. After chatting with the engineers at FB, they fixed the problem, so it wasn't an issue with just you.
when I use
$facebook->api("/userId/feed/", 'POST', $attachment);
Facebook post to my friends wall who authenticated with my application.
I don't want this.
And when I use
$facebook->api("/me/feed/", 'POST', $attachment);
Facebook post to my feed only.
so I want my APP to post $attachment array to my feed (as me) and every authenticated user feed (as him) without posting to friends wall. (sure I have stream_publish permission from authentication process)
When you authenticate the user and the user authorizes your application's permissions, Facebook provides you with an access token for that specific user. You need to persist this access token in a database (or where ever you see fit). Each time you make a request to the Facebook API, you need to pass this access token.
So, you can post as a user on their own wall by using the /me/feed endpoint, but you need to pass the user's access token along with your request. The access token is how Facebook knows who "me" is referring to.
As an example, let's say I use your application. I authorize your application with my Facebook account and Facebook gives you an access token that represents me. I use your application to post a message on my wall: "Hello World!" You then submit a request to the /me/feed/ endpoint using my access token. The message "Hello World!" will show up on my Facebook wall and shows that it was posted by me.
I went through this wonderfull tutorial on Using App Access token. According to this post it says that:
If the user has not provided the appropriate permissions to publish on the user’s behalf, you will receive an error message. For example, if the user has not provided the publish_stream permission, the following error will be returned:
{
"error": {
"message": "(#200) The user has not granted the application the permission to automatically publish feed stories",
"type": "OAuthException",
"code": 200
}
}
Now is there any other way to post to a users wall who has not authorized the app?
My query is this:
I have two logins for my app, one Login with Email and other FB Connection. So a user may login with email or facebook to my app. If he logs in with facebook there is no problem at all as i have his access token. If he login with email , then i don't have his user access token, so in this case i want to use the App Access token to fetch the users friends and then allow him to post to friends wall [friends who are not a member of our app / not authorized our app].
there is no way to post to a user wall who has not authorized the app.
one possible soln:
you have to link up the user login via the email and fbID
stored the access token when the user accesses your app via fbID
if the user login via the email, then get the access token from local storage and use it for the posting.
I have a question, I'm trying to post on a page with the token acquired from
https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&
grant_type=client_credentials
I guess the app has permission to post on that page, but when I try to post I get the following error
{
"error": {
"message": "(#200) The user hasn't authorized the application to perform this action",
"type": "OAuthException"
}
}
How do I verify the permission?
Basically, I want to be able to post to a page as a page without asking user to login, Would be great if someone can help me out!
The token that you are acquiring is an App Access Token.
And to post on a page as a page itself, you need a page access token.
To get the page access token, you need to make the following API call with an access token with manage_pages permission:
/{page-id}?fields=access_token
this will give you the page access token for your pages. Use that and publish the post.
You can also have a never-expiring page access token. To get one follow this: What are the Steps to getting a Long Lasting Token For Posting To a Facebook Fan Page from a Server
I got the following exception when i try to post a message on a friends wall using the REST API
The user hasn't authorized the
application to perform this action
here is my code.
$status=$facebook->api_client->stream_publish($message,null,null,$id,$user);
How to get authorization from a user to post a message on his wall? Or any work around to do this ?
During the authentication process, you need to request the publish_stream extended permission from the user before your application is allowed to post on behalf of that user.
Assuming this is a canvas application, this page will probably help you along.