python - Facebook Access Token for Single User Application -
i'm creating application on facebook ever have 1 user: me. i'm not making gui application, means there's no client side auth.
is there way can use username , password or other app information access token myself?
i'm familiar refresh token flows , oauth applications other people, i've never done without sort of facebook login button, on 1 person application. i'm happy hard code in user information.
i've tried using this:
access_token_url = 'https://graph.facebook.com/oauth/access_token?type=client_cred&client_id=' + config['app_id'] + '&client_secret=' + config['app_secret'] token_response = urllib.urlopen(access_token_url).read() access_token = token_response.replace('access_token=', '') session = facebooksession( config['app_id'], config['app_secret'], access_token, ) but doesn't give me access token specific own account, 1 application itself.
i managed figure out. here's did:
i went graph api explorer (https://developers.facebook.com/tools/explorer) , got access token there application.
once had token used url long lived token using access token:
token_exchange_url = 'https://graph.facebook.com/oauth/access_token? client_id=app_id& client_secret=app_secret& grant_type=fb_exchange_token& fb_exchange_token=access_token' exchange_response = urllib.urlopen(token_exchange_url).read() access_token = exchange_response.replace('access_token=', '') access_token = access_token[:access_token.index('&')] i saved access_token , on subsequent call can update access_token using code whenever in order make sure it's refreshed.
Comments
Post a Comment