Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook full permission AccessToken alternative to Offline access token

Currently I am using desktop windows service to download my Facebook page insights/ page likes/friends etc. graph data . so, for that i have added app on my facebook page and generated full permission offline access token. so, using that i am downloading my facebook page insights properly from last one year.
But, as Facebook deprecated offline acccess token. Please anyone can help me how i can generate Access Token with full permission to download my page insight data without signing in (witout any User/Ui dialog (allow etc.)).

Right now , i am trying & going through some api to generate that access token as following : - https://graph.facebook.com/oauth/access_token?client_id=xxxx&client_secret=xxxxx&grant_type=client_credentials

But , using above call i am getting access token (short length token) - e.g : -

123484913842345|jkioEjsRAhFrNdertg9zuxPiopl

Using above access token getting following error when try to see graph data : -

{"error": {"message": "Unsupported get request.","type": "GraphMethodException","code": 100  }}

But, i have found that this access token does not have full permissions & also short life.

When I have used my old offline access token then it is giving response properly. (this token will be off after some duration). so, to generate same type of Access token with around 60 day life. Please help me on this. How i can generate access token with full permission with full 110 character length. Also, i am using windows service so , anyone can help on this how to generete access token without signing in (User/UI activity)

like image 314
Spunj Junior Avatar asked Mar 03 '13 16:03

Spunj Junior


People also ask

How can I get Facebook permanent access token?

To get this token, go to the Graph API Explorer of Facebook. Then, in the User or Page menu, select “User Token” (2). Finally click on “Get Access Token”, you will get a User Access Token.

How do I fix an invalid access token on Facebook?

Directly log into Facebook or into your Facebook Business Manager account. You should then be prompted through steps that will re-authorize and unblock your account. Once you have completed the necessary steps the account will be unblocked.

What is FB Accesstoken?

An access token is an opaque string that identifies a user, app, or Page and can be used by the app to make graph API calls. When someone connects with an app using Facebook Login and approves the request for permissions, the app obtains an access token that provides temporary, secure access to Facebook APIs.

Does Facebook use token based authentication?

When your app uses Facebook Login to authenticate someone, it receives a User access token. If your app uses one of the Facebook SDKs, this token lasts for about 60 days. However, the SDKs automatically refresh the token whenever the person uses your app, so the tokens expire 60 days after last use.


1 Answers

To fix this you need to extend the short lived token.

You can also debug the access token without any user interaction to see if the action of extending the access token worked.

This link is a good reference about the expiration of offline access.

When you debug the access token using this url:

https://graph.facebook.com/debug_token?input_token=INPUT_TOKEN&access_token=ACCESS_TOKEN

INPUT_TOKEN is the user access token

ACCESS_TOKEN is the app access token which is formed like so: APP_ID|APP_SECRET To clarify on that, If my app id is 123 & the app secret is abc then the app access token is 123|abc

like image 199
Roni Avatar answered Sep 24 '22 09:09

Roni