skip to Main Content

I am trying to determine if page access tokens used with the messenger api are permanent. Seeing this code in one of their examples, which indicates to me that they are using the token as a constant value :

access_token: PAGE_ACCESS_TOKEN

I get the Page Access Token shown on my facebook app dashboard in this way:
I log into facebook, go to developer.facebook.com, select my messenger app, then on the dashboard go to Products > Messenger > Settings and can select my page and then get a token.

Can I put that value in a properties file and then use it indefinitely with my application when getting/sending messages to and from the page?

I am getting a bit confused regarding the documentation around other tokens, like user tokens and login tokens vs. page tokens.

Editing to add that I am using the page access token in order to make a POST request to this url : https://graph.facebook.com/v2.6/me/messages in order to reply to a message sent to my page by a user.

2

Answers


  1. Chosen as BEST ANSWER

    I believe I have solved this and wanted to post in case anyone else had the same confusion.

    I assumed I needed to make a GET request to a facebook url in my code to get a new token before each Request to GET or POST to the messenger API. Using the information in the links above, I learned how to get an extended token here:

    https://developers.facebook.com/tools/explorer/<my app id here>?method=GET&path=me%2Faccounts&version=v2.10
    

    I then can use that ID indefinitely as it is supposed to not expire. I am going to assume it is OK to put this id into my properties file, if anyone has opinions on a better place to store this token value I would be interested.


  2. Extended Page Tokens are valid forever.

    You need to use a User Token, extend the User Token and then get an Extended Page Token with the Extended User Token.

    More information:

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search