Make Facebook Access Token Permanent

I faced an issue with facebook that how can i set the access_token as permanent. So here are the steps to achieve this.

Step 1 – Crate Page in Facebook like,

Vinc-CreatePage

Step 2 – Create Facebook App from Here

Go to Apps Section and if you are not Registered as Developer then fist Register as Developer and then click on Create App.

Step 3 – Specify App Name etc detail you will be redirected to below screen

CreateApp

Step 4 – Assign Permissions to App like,

VinCPermission

Now Your App and Page both are created.

Step 5 – hit below link with the parameters specified

http://facebook.com/add.php?api_key=*YOUR_APP_ID*&pages=1&page=*YOUR_PAGE_ID*

where App ID will be the Application ID (you can get it from Step – 3) and on editing the created page, will give you facebook page id as show below.

VinCFacebookPageID

Step 6 – Get Short- lived access_token  and allocate “manage_pages” permission to it using below link with parameters

https://graph.facebook.com/oauth/authorize?client_id=*APP_ID*&scope=manage_pages&redirect_uri=http://www.facebook.com/connect/login_success.html

Step 7 – Generate Access_token from “Graph API Explorer” option and give permissions to it – “manage_pages,publish_stream” in Extended Permission section. Now click on Submit will show you the account detail. At this time by using this access_token in link “Access Token Debugger” will show you that Expiration is of an hour only.

Take this generated access_token and use in below link.

https://graph.facebook.com/oauth/access_token?client_id=*APP_ID*&redirect_uri=http://www.facebook.com/connect/login_success.html&client_secret=*APP_SECRET*&code=*Access token from Step 7*

This will may show you the error like “Invalid Verification Code” etc like…. don’t worry.

Step 8 – Use the below to Generate access_token which says Expires -> Never 🙂

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 from Step 7*

This link will give you a new access_token use that access_token in link “Access Token Debugger” will show you that Expiration = (in 2 months) which after few mins will show you below screen where Expiration = Never 🙂

VinCNever

Enjoy ………..

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: