Hello

Thanks very much for this great module. I just have one problem after following the video tutorial - when I add a new content, my rule should post it to facebook, however I get the following message:

Facebook SDK threw an error: OAuthException (#200) The user hasn't authorized the application to perform this action

Do you know what I have or haven't done correctly and how I could resolve this?

Thanks

Comments

carlbowles100’s picture

I managed to fix this by setting appropriate permissions for each role under /admin/config/services/fbpermissions

carlbowles100’s picture

Status: Active » Closed (fixed)
pyxio’s picture

I have the same problem. I was not able to solve it via permissions :( any other possibilities i can check? thanks

e0ipso’s picture

@drupalstrap it's possible that you did not authorize the application to start with.

kaizerking’s picture

same problem here permissions did not solve
I am trying to auto post a node to facebook page
i.e when ever any authenticated user posts a content type "post" it should be posted to Fb page
setting all available permissions also did not solve
Can some one help me on what permissions need to be set in my scenario?

pavelyonov’s picture

Hi there, i have same problem. looking around few days for solution but still not found it.
I just setting up everything fine and when try to save article show me this message: "Facebook SDK threw an error: OAuthException: (#200) The user hasn't authorized the application to perform this action" I allowed all kind of permissions in /admin/config/services/permissions for administrator. I really dont know what more i have to do to work this module. Please help.

jemisond’s picture

Status: Closed (fixed) » Needs work

Same issue

jemisond’s picture

Status: Needs work » Active
e0ipso’s picture

Status: Active » Closed (fixed)

I don't want to sound like a broken record, but I'm going to move this back to fixed. This is the exception Facebook returns when an action is not authorized. This basically means that you're trying to do something you did not ask permission for.

If you have selected all permissions this means that all login requests will ask for those permissions, but if you already logged in you're stuck with the permissions you approved. You will need to go to the admin page and logout and then log back in.

Please, feel free to reopen if you can corroborate that this problem is related to any piece of code that can be fixed.

Sorry for the inconvenience and thank you for participating in the issue queue.

kaizerking’s picture

Log out and login worked for this issue

kruser’s picture

I'm trying to publish to a fb page upon saving a new node. I tried logging out/in, un/re-installing, and still can't get past this message.

When I try to login to facebook, it shows an alert, "The following permissions have not been approved for use and are not being shown to people using your app: manage_pages. Submit them for review or learn more." - From what I've read, the app owner doesn't need to submit for review, but maybe we really do now??

On admin/config/services/fbautopost under the Facebook page information, I can see and select from any of my pages. So I'm confused what permission will get this to work.

Update: I found that the alert really doesn't matter. To post to the page you also have to enable the "Publish Actions" Extended Permissions on admin/config/services/fbpermissions selected - So you need both Manage Pages and Publish Actions to post to a page.

carlbowles100’s picture

have you been to /admin/config/services/fbpermissions and given permissions for each of the required roles? that's what fixed this for me. hope this helps.

aminfa92’s picture

You should live your app on Facebook developer.
At the status an review page set "Do you want to make this app and all its live features available to the general public?" as Yes.
This solves my problem.

Excuse me for my bad English.

Best regards.

Tharick’s picture

Yeah guys FB auto post works fine :-)

But I have one more query, can anybody help me out?

If we post one content from our site, it will automatically generate as post on FB page. But when we edit/modify the same content what we posted on FB, it should be update on FB page.

How can we do this via rules? please help me guys?

e0ipso’s picture

I believe this was covered in the docs a while ago. Documentation is very hard to write, so if you want to show a token of appreciation for all the work put into this module, please write a tutorial in there.

https://www.drupal.org/node/1914896

boabjohn’s picture

Status: Closed (fixed) » Active

G'Day @e0piso, or buenos dias, que tal hombre?

Very sorry to re-open this one. It surely deserves some proper documentation. Perhaps I can try to start some here as a way to explain what trouble I'm having.


Usecase:

A non-profit organisation has a Drupal site, and they have a Facebook *page*. They wish to publish news items on their Drupal site and autopost to the FB page.

(1) Authorise the developer as FB admin
The client adds me (ie, my *personal* FB account) as an admin to their page. Now I am authorised by FB to "do things" with that page.
(a note for further discussion: this arrangement may cause problems in the future ...how can I set up the app and permissions without needing to use the client's personal FB account?)

(2) Developer creates App
I go to https://developers.facebook.com and under [My Apps] choose to [Add new App]

(3) Configure App on FB
Under [Settings] > [Basic] I fill in the basic info and copy out the App ID and App Secret
Under [Settings] > [Advanced] I make sure that the Client OAuth login is enabled. I copy out the Client Token and save it for later (?) I don't know any other settings to make on the [Advanced] tab

(4) Check the App on FB
Clever people may know how to use the Test App process...I don't. The main thing I look for is on the [Dashboard]. My App name has a green dot and a note that "This app is public and available to all users"

(5) Install Drupal module and create Rules
This is well documented already, but not the permissions

(6) Set Drupal user ownership for facebook_publications in Rules
This is unclear to me. The client users will be posting new Drupal content. But in Rules I am asked to set a specific user to own the facebook_publication entities. Taking a punt, since these are "internal" content objects, I set the user ID to 1. But I will point out that it is yet another place where we could have a question about permissions. Needs to be explicitly documented.

(7) Set the Drupal: Facebook Permissions
Permissions are set at: ../admin/config/services/fbpermissions
This looks like a well-thought-out UI that allows us to select first a Drupal role, and then connect that role with the FB-specific permissions that might be required.
We use the v2.0 Version
In my dead-simple usecase, we are only interested in [Extended Permissions - Publish] > Publish Actions
We find that, for all roles, this value is already defaulted on.
I believe this is the only action needed to publish our content onto a FB page (link and status updates)

(8) Log out / Log in
Based on comments in this thread...Not sure what usecase this is for...or *what* we are logging in and out of. To be safe I log out of both Drupal and Facebook. Then re-log in.

(--) FAIL
Finally we give it a try. Publish a new content node and get the error reported above:

Facebook SDK threw an error: OAuthException: (#200) The user hasn't authorized the application to perform this action

Read this thread, note e0piso's patient guidance, but remain confused about permissions, or what to do next.

So: deal to you (and the d.o community)... Please help me troubleshoot this oauth problem and I will fix/finish the documentation started here and drop it into the module's doco pages.

Thanks indeed!

e0ipso’s picture

@boabjohn can you do the same tests using the same credentials as the FB fa page owner?

boabjohn’s picture

G'Day mate, thanks for the look-in.

Can I check what you mean in this case?

  1. (on Facebook) there are 6 people, 4 of which are role=admin, 2 role=editor, none role="owner"
  2. (on Facebook developer) I could pick one of the other admins on the page and use their login to create a brand new App, then put those ID and API secret into FB autopost...but that would be tomorrow at the earliest
  3. (on Drupal) I could login as another person, who is also a FB page admin as above, but I'm not sure at what point their Drupal account credentials interact with FB OAuth...afaik the only thing FB OAuth is looking at is the API key, and checking that the Drupal role is pre-cleared to have specific permissions on the FB API....so, since I'm U1, it would seem like a step down to login as a less privileged user.

But...I'm probably confused still. Sorry man!
Can you offer a few more simple guidelines for how I should test?
Thanks in advance!

Only local images are allowed.

boabjohn’s picture

StatusFileSize
new78.25 KB
boabjohn’s picture

Just reviewing:

1. On the FB Developer site, under the [Status & Review] tab, my app clearly states that it is *only* authorised to:

  • email - Provides access to the person's primary email address.
  • public_profile - Provides access to a person's basic information
  • user_friends - Provides access to a person's list of friends

That's it...there's no mention of extended permissions. To authorise the app for publish_actions and manage_pages I *must* submit the app to FB review (apparently). This involves a lot of silly business aimed at people who are developing apps for public use.

Have I got something wrong here, or is this the "proper method"? Seems very obtuse.

2. On my Drupal site, in fbpermissions, of course I have authorised the app to publish_actions.

But it appears that FB doesn't care what is declared by Drupal...I still have to vett the app with the FB review process...and that just seems awkward given the fact that this "app" should not really be public, is not intended for public use, and has no UI of its own. It's just an authorisation widget to exercise the FB API, right?

Anyway, I have tried to fill out the FB review steps best I could andwe'll see what happens next.

If anyone can set me onto the proper cluetrain it would be HUGELY appreciated!
Thanks,
JB

boabjohn’s picture

Priority: Normal » Major

Well, I guess it's my turn to "sound like a broken record" to borrow the phrase from @e0ipso at #9 above. However, I am increasingly convinced that there is something wrong with the module.

Trying to sort the OAuth error out means I've had to learn a bit about Facebook. As reported above at #20, I went through the process of submitting the App for Review at Facebook. They turned it down, noting:

You don’t need any extended permissions for an app that you admin. App admins, and any account listed as a ‘role’ in the App Settings page, can access all permissions without submitting for review. This means you can publish contact back to Facebook for your app. You only need to submit for review if you have a public facing login.

Ok, so as far as FB is concerned, the app that I admin should be able to publish content to FaceBook using the app.

However, FB returns a 200 OAuth error saying the "user" hasn't "authorised" the application.

So what does that mean in terms of configuring this module?

Obviously if I set fbpermissions to allow role=admin to use publish_actions and manage_pages, then I assume that this is the permission being passed to FB along with the API keys so that it receives a post request *as an authorised user*.

However, FB says the user has not authorised the app for that action.

PLEASE can someone wade in here to explain which part of the authorisation train has gone off the rails?

Until shown otherwise, I am assuming that the module itself is dropping some bit of the API exchange, and thus this is a *major bug*.

Apologies for going on like a broken record: I'm sure there must be some configuration that I'm missing...but it is definitely NOT OBVIOUS.

boabjohn’s picture

Category: Support request » Bug report
boabjohn’s picture

Just to be clear, "I" am an admin for the Facebook **page** and "I" set up the FB **App** on FB Developer, so "I" am the administrator from FB's perspective. "I" am also U1 on the Drupal website.
Of course the actual username and password for my Facebook account have nothing to do with the U1 Drupal account...nor should they.

As U1 I login to Drupal and configure the FBAutoPost module to give it the secret API details, and I also set the fbpermissions. So that should be the end of the story....

How then does FB return the OAuth error???

e0ipso’s picture

Category: Bug report » Support request
Priority: Major » Normal

It seems to work for other people. Most people in this thread had some configuration error while setting up their Facebook app or permissions.

I agree with you on that the documentation does not cover this. Can you add it?

duiweboer’s picture

@e0ipso : thanks for the great module!

@boabjohn:

I had the same problem as I had no idea how to add the app on facebook. I managed to resolve it by doing the following:

In fb developer -> App Details -> Under "App Center Listed Platforms" -> click the "Configure App Center Permissions"

I changed the "Auth Totken Paramater" to "URI Fragment(#access_token..."
Under "API Version and App Center Permissions" I added: "manage_pages" and "publish_actions"

On drupal fbpermissions for now I just ticked everything for roles "authenticated users" and "administrators"

I am sure not all of it is needed, but I do not have time at the moment to see what exactly solved it, but I am sure this should get you going and you can complete the documentation. Let mek now if I can be of any further assistance.

boabjohn’s picture

@e0ipso: yep I'd be happy to contribute documentation *once I'm actually publishing*...at the moment I'm simply floundering around trying to turn on any permission in sight in order to get the app to post.

@duiweboer: thank you so much for the interesting pointer to the App Center Permissions. It did not clear the OAuth problem in my case. Mysterious...and I would again wonder why such permissions would be needed (ie *App Center*) when the app is not really supposed to be coming in contact with the App Center. But again, that is vague reasoning on my part: I really don't understand the FB process.

Bottom line: I've set the App Center as suggested and once again turned on any permission that looked even distantly related to manage_pages and publish_actions in Drupal>fbpermissions

Same result.

@duiweboer...I would be more than happy to offer some sort of short term contract (a few hours?) to go through our configuration and see if you can spot what's happening?

Thanks..and respects to the immensely talented and vastly over-committed @e0ipso of course for helping to bring such a great functionality to Drupal.

Kind regards,
JB

boabjohn’s picture

My offer still stands: cash for short -term contract to help us sort this out.
We're suck on this point.
FB AutoPost is just the right size solution for us...clearly other people get it to work...no one seems to have been able to clue us in as to what specifically is wrong in our case.
Any help most gratefully received (and compensated if need be!)
Please send me a mesage here on d.o

paonza’s picture

hi!
I resoved with this tip!

http://www.phpgang.com/how-to-post-into-a-facebook-page-with-php-using-g...

hope can be useful!

ciao
Fabio

drupalerocant’s picture

@boabjohn #26,
I was having same problem as you and finally get it working! I read in some page that to authorise the app for publish_actions it was not necessary to submit the app to FB review although it is necessary for manage_pages. So i removed Manage Pages from Page Permission (admin/config/services/fbpermissions) and login again(admin/config/services/fbautopost). At first it showed me a message to send the app to review but i Saved configuration anyway. Published a post and i didn't get anymore errors.
Hope it helps!

nevosa’s picture

I was able to resolve this by changing in facebook "use as page admin", and then assigned all permissions to admin on drupal
(admin/config/services/fbpermissions).

Then I went to my user, and disconnected from facebook. The app permissions popuped again everything was sorted.

e0ipso’s picture

Status: Active » Fixed

As much as I want to find more time to contribute to FB Autopost I can't find it. It would be awesome if any of you created a documentation page to link gathering all the tips & tricks listed in this issue.

Maybe updating this https://www.drupal.org/node/2360835 will be enough.

Many thanks to all of you who contributed here!

Anonymous’s picture

I have had the same problem as boabjohn & like him, I have been unable to come up with a set of configurations between Facebook App, Facebook page, & this module that allows me to successfully post from Drupal to a Facebook Page. A big part of the problem is the ugliness of Facebook's documentation & how convoluted their OAuth & App implementation is.

Anyway, I am currently using an alternative method until I can get this figured out & thought I would share it in case others have this problem & cannot resolve it. The alternative method: I have installed the Twitter module, which allows you to post to Twitter in a manner comparable to what Facebook Autopost does for Facebook. Within Twitter you can configure an app that will post any tweet you make to a Facebook account or Page timeline (or both). So from Drupal to Twitter to Facebook--kills two birds with one stone & works well.

P.S.: Twitter's App creation & configuration process is so much nicer than Facebook's!

Langley’s picture

Lately ive also encountered this issue on installation that previously worked with testing account. After trying all the tips described in this thread i finally used google properly.

I came across latest facebook changelog stating:

Changes to Page APIs:

publish_pages Permission - This new permission is required to publish as a Page. Previously publish_actions was required. People who granted manage_pages and publish_actions before v2.3 have automatically been granted publish_pages. If anyone logs in via v2.3, you'll need to request publish_pages explicitly in addition to manage_pages.

After adding publish_pages to the permissions listed in the module and granting the apps permissions again everything is working as expected.

bpadaria’s picture

Thanks Langley,

Adding publish_pages permission worked perfectly.

benmmc’s picture

StatusFileSize
new56.1 KB

How did you add publish_pages permissions, exactly, @bpadaria?

I submitted my app for review with the publish_pages permission, and got back this.

FB publish_pages

I've done every step, but still get the OAuthException (#200) error.

Anand Parmar’s picture

I am also getting the OAuthException (#200) error. Have followed every step and video tutorials. Kindly help.

Anand Parmar’s picture

I was reading the issue queue of another Drupal Module 'Facebook OAuth' at https://www.drupal.org/node/2464367
And I find this information which I feel is the cause of the sudden breakdown. It has these main points

  • Facebook introduced new API 2.x
  • v1.0 will be deprecated on April 30, 2015
  • API 2.x has some difference with permission and variables
  • We need to make people understand, that the new Facebook API may break functionality.

Hopefully the module developer will be able to throw more light on this.

Anand Parmar’s picture

Status: Fixed » Needs review
Anand Parmar’s picture

While going through the changelog of Facebook graph api v2.3 at https://developers.facebook.com/docs/apps/changelog there is an informative paragraph about posts to page.

publish_pages Permission - This new permission is required to publish as a Page. Previously publish_actions was required. People who granted manage_pages and publish_actions before v2.3 have automatically been granted publish_pages. If anyone logs in via v2.3, you'll need to request publish_pages explicitly in addition to manage_pages.

Anonymous’s picture

Langley: This solved the problem for me. I found that even after successfully going through the the Facebook App review process & gaining manage_pages & publish_actions permissions for my App, & even when using handcrafted Graph API POST URL requests (using http://hurl.it) with all proper access tokens, I was getting the OAuth 'user has not granted permissions' error. As soon as I patched this module to request publish_pages permissions, & rerequested & granted permissions (this time with publish_pages requested & granted), I was able to post to my Facebook Page as the Page both with this module & with handcrafted URLs. So it seems that it is indeed the new v2.3 API permission that is breaking this module.

I am attaching a patch to add the publish_pages permission to the Facebook Autopost Permissions module. Apply the patch to the current dev version, & a new option will be available at admin/config/services/fbpermissions, under the Pages group, to assign the publish_pages permission to a particular user role. After applying the patch & assigning the role, be sure to log out at admin/config/services/fbautopost, & to delete the Facebook App you have configured from your user settings for your Facebook account. Then at admin/config/services/fbautopost, under Facebook Page Information, click to log in again, & you should be taken to Facebook which will prompt you to accept the Facebook App & give it permissions. Be sure to accept all permissions. You should see publish_pages as one of the permissions the App is asking for.

Anand Parmar’s picture

StatusFileSize
new53.79 KB

I confirm rhclayto's patch is working. Attached is the screen shot of post updated from test website with image and body text to FB page wall. Screen shot of successful post to FB.

The only puzzle needs to be resolved is I want to image or images of the node to be saved to FB photos in an album named by content type for example 'school-news' etc. If some one has an idea how to achieve this.

Anonymous’s picture

Category: Support request » Bug report
Priority: Normal » Major

This should be a bug report since it's confirmed that because of the new Facebook API update the current code doesn't work. Also major for the same reason. Hopefully we can get this RTBC & committed soon.

Anonymous’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
Component: Miscellaneous » Code

Also going to put this in dev branch, since the patch is against that branch.

person101x’s picture

I am using the dev branch, but I am still receiving the #200 error code, even after logging out / logging in and granting all permissions for app to post on Facebook.

Any suggestions?

  • e0ipso committed ac083b9 on 7.x-1.x authored by rhclayto
    Issue #2284189 by rhclayto: Facebook SDK threw an error: OAuthException...
e0ipso’s picture

Status: Needs review » Fixed

Thanks @rhclayto for the patch!

This has been committed to dev. I'll be tagging a new release for this.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

dany_faccio’s picture

I'm trying to apply @rhclayto's patch and, forgive me for my ignorance, but I have no clue of where to add it :(
"Apply the patch to the current dev version"-can anybody tell me where exactly is that, please? What file should I edit to add it?

Thanks a lot!!!

Anonymous’s picture

On the main project page, under Downloads, the 7.x-1.x-dev version should now have the patch already committed to it, so no there is need to apply this patch manually.

classicaldeal’s picture

In configurations/web services/ fb permissions... i set all permissions admin is having for drupal authenticated user also but still not allowing to post on facebook page for my website www.classicaldeal.com , any thing else which needs to change ?
Thanks in advance

xadag’s picture

I had the same problem and solve it by :

Create a new app with the 2.5 api version

Apply this patch : https://www.drupal.org/node/2602478 and use the latest SDK PHP of Facebook from https://github.com/facebook/facebook-php-sdk-v4

And also on the facebook autopost permission admin page, set manage_pages, publish_pages permissions to the role authenticated user.

After that going on the facebook autopost admin page, logout from my account and renew login to set permission and autorisation for my facebook account and the app

After i was able to post to my pages. The user must be administrator of pages.