I am using fandjango
and facepy
for building facebook application.
So, this is how my code looks.
from fandjango.decorators import facebook_authorization_required
from facepy import GraphAPI
@facebook_authorization_required(permissions=["publish_actions"])
def ViewPage (request):
user_access_token = request.facebook.user.oauth_token
....
profile_id = request.facebook.user.facebook_id
graph = GraphAPI(access_token)
og_path = "%d/feed" %profile_id
..
graph.post( path = og_path, og_msg = message )
..
When I opened the page, it showed OAuthError
. I search around this website and some mentioned that there would be mistake in access_token
. When I tried to print the access token on the dev-page, it showed me Oauth Token Object
.. i.e., its not "access token" (expected "string" object).
So, where am I doing wrong? and how should I fix the error.
@facebook_authorization_required(permissions=["publish_actions"])
def ViewPage (request):
user_access_token = request.facebook.user.oauth_token.token
....
graph = GraphAPI(access_token)
request.facebook.user.oauth_token
is object
type...
request.facebook.user.oauth_token.token will give you the access token