GNU/Linux, Open Source, Cloud Computing, DevOps and more...

How to get a permanent token to access a Facebook page


Through the following instructions you can easily get a permanent access_token to automatically connect your applications to a Facebook page and be able to obtain for example your number of followers periodically, get new likes or comments in real time, publish new entries in the timeline, or any of the possibilities offered by the Facebook Pages API.


1. Get Facebook page identifier

Método de obtención del identificador de una página de Facebook - Paso 1Método de obtención del identificador de una página de Facebook - Paso 2

2. Create a FB App for your page

2.1 Go to My apps.

2.2 Create new app, for example AppMipagina:

Pasos para la creación de una nueva FB App2.3 The previous step will take you to the administration page of your new App. There you will select the Configuration menu option and the data that we are interested in will be shown: the application identifier and its secret key, which you can only access by clicking on the Show button (#2 in the next screenshot). Do not forget to select the category “Applications for pages” (#3) and save changes:

Página de administración de app Facebook3. Get short-lived access token

3.1 Go to Facebook API Graph Explorer.

3.2 Select the page for which you want to obtain the access token in the right-hand drop-down box, click on the Send button and copy the resulting access_token, which will be a short-lived token (2 hours).

Explorador de la API Graph Facebook para desarrolladores4. Get long-lived access token

4.1 Enter the following URL in your browser’s address bar:{app_id}&client_secret={app_secret}&fb_exchange_token={short_lived_token}

That in our example would look like this:

The result will be something like this:


The alphanumeric string “access_token”, marked in bold, will be the long-lived access token we wanted to get, which, as the expires_in attribute indicates, expires 5,184,000 seconds after being generated, ie 2 months.

5. Get permanent access token

But even though a couple of months is a considerable time, it can be quite tedious to have to repeat this process every 2 months in order to renew access for your applications, so there is still one last step in order to get the permanent access_token that we were pursuing from the beginning, which will no longer be necessary to renew once generated.

So you will get to the following URL from your browser:{page_id}?fields=access_token&access_token={long_lived_token}

That in our example would be:

The answer you get will look like this:

   "access_token": "EAAUAA6XzH3sBAByxmePXoivAX8DamdhghHUNWEZBxdXnQZAZAUPbDpBrmS6PexVeka3JTL9Vxn8eQe6wBLnlPbsN06nBPhxQhp0tKNrdZALXIEHgVANOb4U2eIz3BRHqTCAjSoFxqVZBWjc9K3qHyyRcGczccU7NRWjj5OkzxbAZDZD",
   "id": "315781431851791"

And now, yes, this token linked to the Facebook page with the id that appears in the answer (315781431851791 in our example) is permanent.

6. Verify that the generated token is permanent

You can confirm the generated token is permanent using the Facebook Access Token Debugger:

Depurador access token permanente

If you find it more convenient, you can follow these same instructions through the following video:


About the author

Daniel López Azaña
Freelance AWS Cloud Solution Architect & Linux Sysadmin

Entrepreneur, a generator of ideas and restless mind. Passionate about new technologies, especially Linux systems and Open Source Software. I also like to write about Technology News, Cloud Computing, AWS, DevOps, DevSecOps, System Security, Web Development and Programming, SEO, Science, Innovation, Entrepreneurship, etc.

DanielHow to get a permanent token to access a Facebook page

Related Posts


Join the conversation
  • Joe Tan - 01/06/2018 reply

    Thanks man, it helped me.

  • Alex - 04/12/2018 reply

    If you cant get the permanent access token make sure your app is in development mode.

  • Abel - 28/10/2020 reply

    Hola, puedo hacer esto para una página que no sea mía? O sea, quiero verificar por PHP cuando cierta página (que no me pertenece) esté transmitiendo en vivo. ¿Será posible?

Leave a Reply

Your email address will not be published.