0
votes

I am going to post message to my facebook's page with a standalone python application. Please notice that it is not a we application - just a script deployed and working on my local machine.

I read the facebook's documentation and I know that I need to create a facebook's app which I will be connecting to and which will send requests on the behalf of my 'real' python application. I discovered that I needed to create a facebook app as a 'Website app' and I did it. I discovered than with a switch "Settings->Advanced->Native or desktop app?" set as 'No' I am able to get my access token with the url:

https://graph.facebook.com/oauth/access_token?client_id=MY_APP_ID&client_secret=MY_APP_SECRET&grant_type=client_credentials&scope=manage_pages,offline_access

Now I am almost there. I can get information of my facebook user and my facebook page. But I can not post anything to user's wall neither page's wall because I got the error:

(#200) The user hasn't authorized the application to perform this action

I read that I may use the following URL to grant manage_pages privileges to my app:

https://graph.facebook.com/oauth/authorize?client_id=APP_ID&scope=offline_access,publish_stream,manage_pages&redirect_uri=REDIRECT_URI

but I do not know what to put in REDIRECT_URL as in fact my real standalone app has no url at all. I tried to put some facebook's addresses there but it does not seem to be a good idea.

What I am doing wrong? I suppose I need to switch "Settings->Advanced->Native or desktop app?" to Yes but then I am not able to get access token... Should I get this token in some other way?

Best regards

1

1 Answers

0
votes

offline_access and publish_stream are deprecated since many years, you need publish_actions for posting. And you should use an Extended Page Token that is valid forever. Check out the following links to find out how to get that Token: