I\'m trying to get an access_token from Instagram to use their Basic Display API for a new app (simply display tweets on a webpage).
I followed these steps: https://
I was using the old Instagram API as well. I had to change a few things to make my code work on the new API. Not sure what you're using, this is how I did it with PHP.
$url = 'https://api.instagram.com/oauth/access_token';
$fields = array(
'app_id' => 'YOUR_APP_ID',
'app_secret' => 'YOUR_APP_SECRET_ID',
'grant_type' => 'authorization_code',
'redirect_uri' => 'YOUR_REDIRECT_URL',
'code' => $code
);
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_VERIFYPEER, false);
$result = curl_exec($ch);
curl_close($ch);
//get the access token from the string sent from Instagram
$splitString = explode('"access_token":', $result);
$removeRest = explode(',', $splitString[1]);
$withSpace = str_replace('"','', $removeRest[0]);
$access_token = str_replace(' ','', $withSpace);