Richard Lee
Richard Lee

Reputation: 213

instagram follow api error

Objective -C / iOS

I will use follow api of instagram .

set URL :https://api.instagram.com/v1/users/{userid}/relationship?access_token={access_token}

parameter string is "action=follow" ,and data sending way of post

But , it doesn't works. I received error.

meta =     {
    code = 400;
    "error_message" = "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.";
    "error_type" = OAuthPermissionsException;
};

When i use login api of instagram , scope = relationships+likes ... data sended

How to use instagram follow api in iOS.

Upvotes: 1

Views: 1041

Answers (3)

Sanat Manhas
Sanat Manhas

Reputation: 26

Instagram changed its API guidelines since mid April, 2015.

https://help.instagram.com/contact/185819881608116

The OAuth 2.0 specification allows you to specify the scope of the access you are requesting from the user. All apps have basic read access by default, but if you plan on asking for extended access such as liking, commenting, or managing friendships, you need to specify these scopes in your authorization request. Note that in order to use these extended permissions, first you need to submit your app for review. For more information on how to submit your app for review, please check out the documentation of the endpoint that you plan to use.

Hence you need to get your app reviewed by instagram first to use these extended permissions such as Likes, Comments and Relationships.

Upvotes: 1

This is a post request. To make post request to InstagramAPI you need to submit your application details and company details to Instagram for review. Maybe other relationship endpoints will work fine without submitting your app. Even though you are adding scope as scope=likes+relationships+comments, instagram will give you basic permissions only. For more details visit the following link https://instagram.com/developer/endpoints/relationships/#post_relationship

Upvotes: 0

Artal
Artal

Reputation: 9143

As stated in the error that you're getting, you need to have a certain permission for you to be able to perform a "follow" action. You can't just follow another account on a user's behalf without getting the proper permission first in the authentication process.

When calling the authorize api you can add a parameter called scope which specifies the permission level that your app is requesting. For example: scope=basic+relationships will allow you to read all basic user data and also follow and unfollow accounts on a user’s behalf.

Upvotes: 0

Related Questions