-1

Working on a site using Wordpress as a headless CMS. We had an instagram feed on the site using the old API, and are switching over the the new Graph API. We are using this plugin in Wordpress, but just using it to generate an access token which we use in our own PHP to make a call to the API and send the response to the front-end.

The call looks like this:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://graph.instagram.com/me/media?fields=id,caption&access_token=" . $access_token);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$data = curl_exec($ch);

The access token is there, and newly created, but we get an error with code 190 back from the API:

{"error":{"message":"Failed to decrypt","type":"OAuthException","code":190,"fbtrace_id":"ASRrRc2KE2ZegUesqjtv9bA"}}

A little googling told me this is usually due to an invalid access token, but again, the token is brand new and should be working.

What am I missing here?

Chris
  • 884
  • 1
  • 11
  • 30

1 Answers1

0

When in development mode, the token for test Instagram account must be generated from App's settings in Facebook. Go to:

YourApp > Products > Instagram > Basic Display

Scroll down to "User Token Generator" box and click Generate Token. Then paste the token in your oauth table to use it.

Using the code to generate token is only for Live.

Steve A.
  • 1
  • 1
  • 3
  • Using the Instagram Basic Display API, this is false. That would be hard to not be able to get Token with code in development phase... – YamneZ Jul 22 '21 at 14:36