Skip to content

Token conversion to long live token #23

@matjamr

Description

@matjamr

Description

As a User I'd like to be able to consistently call backend without invalid access token errors and receive webhooks properly. That is why long live token needs to be introduced

Preconditions

Permission to fb cosmo pk developer content access
Possibility to obtain facebook access token with proper permissions (reference to docs in backend repo

Flow

1.Obtain access token
2.Send short live access token to backend
Url: https://cosmopk.pl/api/facebook/token
Headers: API-KEY
Body:

{
    "token":"<YOUR_TOKEN>"
}

3.Application wants to retrieve page access token
4.Convert Page Access Token To (LONG TOKEN PERIOD) Page Access Token
5.Expected is success, token ovveride in cache, only one token in db.

Details

As of today token storage is set for short token period, that is why it is kinda unbearable. After user sends token, then it should out of box convert it to long live token.

curl -i -X GET "https://graph.facebook.com/{graph-api-version}/oauth/access_token?  
    grant_type=fb_exchange_token&          
    client_id={app-id}&
    client_secret={app-secret}&
    fb_exchange_token={your-access-token}" 
{
  "access_token":"{long-lived-user-access-token}",
  "token_type": "bearer",
  "expires_in": 5183944           // This needs to be taken from response and set as expiration time.
}

References

https://developers.facebook.com/docs/facebook-login/guides/access-tokens/get-long-lived/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions