A
A
Anton2015-04-19 17:57:41
PHP
Anton, 2015-04-19 17:57:41

Using the Instagram API - modifyRelationship. Where is the mistake?

It is required to implement a subscription to the Instagram channel from an external resource. Based on the solution from here - https://github.com/cosenary/Instagram-PHP-API/wiki... At the output I get an error - "This request requires scope=relationships, but this access token is not authorized with this scope. The user must re-authorize your application with scope=relationships to be granted write permissions". Can anyone suggest what is wrong here?

require 'instagram.php';

$instagram = new Instagram(array(
  'apiKey'      => 'f3e0382a0d004cfabbb8d2e0d2965296',
  'apiSecret'   => 'cf0f57e327634e78baee3164cb100587',
  'apiCallback' => 'http://localhost/insta/follow.php' 
));

 $login = $instagram->getLoginUrl(array(
    'basic',
    'relationships'
  ));

  echo "<a href='{$login}'>Login with Instagram</a><br><br>";
  
  $code = $_GET['code'];
  $token = $instagram->getOAuthToken($code, true);
  
  $instagram->setAccessToken($token);

 $result = $instagram->modifyRelationship('follow', 1993209855);

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SapaSoul, 2015-04-23
@tohin15

In order to perform actions by subscribing, likes, comments, you need to receive additional permission, while they consider the finished code so that they do not initially make robots

B
bzz, 2015-04-20
@bzz

rights are missing. when receiving a token, you need to specify scope=relationships
https://instagram.com/developer/authentication/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question