Posting to a page via a server application

48 views
Skip to first unread message

whippe...@gmail.com

unread,
May 7, 2013, 5:25:18 PM5/7/13
to res...@googlegroups.com

I am writing an application that needs to post to a Facebook page.  I have code that gets a user access token by using the oauth URL below.


With the user access token I then get a page access token.  I followed an example in the following link that worked and it works for me (http://thoughts.citynaksha.com/2011/04/post-on-facebook-page-as-page-not-as.html).  I get the accounts for the user and then loop though them to find the page access token and then post to it using RestFB.

However, the next time I need to get a user access token, I get an error message such as.

{"error":{"message":"This authorization code has been used.","type":"OAuthException","code":100}}


The user access token I created initially was based on the oauth authorization code I get using a URL such as the one below.

https://www.facebook.com/dialog/oauth?client_id=MY_APP_ID&redirect_uri=MY_REDIRECT_URI&scope=manage_pages,offline_access,publish_stream

When I enter it on a browser, it will display the Facebook login page if I'm not already logged into Facebook as a user before redirecting and giving me a authorization code.
 
Is there a way to obtain a authorization code or user access token programatically without going though the Facebook login dialog (https://www.facebook.com/dialog/oauth?client_id=MY_APP_ID&redirect_uri... etc)?  I want my application logic to get a new access token if necessary but I don't want my user interface dependent on or tied to a Facebook login.  Does anyone have some code examples for the situation I'm describing.
 
Reply all
Reply to author
Forward
0 new messages