instagram 关注 api 错误

instagram follow api error

Objective-C/iOS

我会用 follow api 的 instagram 。

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

参数字符串为"action=follow",数据发送方式为post

但是,它不起作用。我收到错误消息。

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;
};

当我使用 instagram 的登录 api 时,scope = relationships+likes ... data sended

如何使用 instagram 在 iOS 中关注 api。

如您遇到的错误所述,您需要获得特定权限才能执行 "follow" 操作。在身份验证过程中没有首先获得适当的许可,您不能代表用户关注另一个帐户。

调用授权 api 时,您可以添加一个名为 scope 的参数,该参数指定您的应用请求的权限级别。例如:scope=basic+relationships 将允许您读取所有基本用户数据,还可以代表用户关注和取消关注帐户。

这是一个 post 请求。要向 InstagramAPI 发出 post 请求,您需要将您的申请详细信息和公司详细信息提交给 Instagram 以供审核。也许其他关系端点在不提交您的应用程序的情况下也能正常工作。即使您将范围添加为 scope=likes+relationships+comments,instagram 也只会为您提供基本权限。欲了解更多详情,请访问以下 link https://instagram.com/developer/endpoints/relationships/#post_relationship

自 2015 年 4 月中旬以来,Instagram 更改了其 API 准则。

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

OAuth 2.0 规范允许您指定您请求用户访问的范围。默认情况下,所有应用程序都具有基本的读取权限,但如果您计划请求扩展访问权限,例如点赞、评论或管理好友关系,则需要在授权请求中指定这些范围。 请注意,为了使用这些扩展权限,首先您需要提交您的应用程序以供审核。有关如何提交您的应用程序以供审核的更多信息,请查看端点的文档你打算使用。

因此,您需要先让您的 应用通过 instagram 审核 才能使用这些扩展权限,例如点赞、评论和关系。