Search code examples
access-tokenfacebook-access-token

Why is short-lived access token generated from URL unable to generate long-lived access token?


I need to make standalone app (using Facebook SDK for .NET) that posts photos to group album and wall. I want to get long time access token. I tried it in 2 steps:

Step 1: Get short-lived access token

https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=APP_SECRET&grant_type=client_credentials

It returns me token like this:

access_token=APP_ID|SHORT_ACCESS_TOKEN

Step 2: Get long-lived access token

https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=APP_SECRET&grant_type=fb_exchange_token&fb_exchange_token=SHORT_ACCESS_TOKEN

I get this error:

{
   "error": {
      "message": "An unexpected error has occurred. Please retry your request later.",
      "type": "OAuthException",
      "code": 2
   }
}

How can I fix it?


Solution

  • problem is solved by taking SHORT_ACCESS_TOKEN directly from Graph API Explorer