目标-C / iOS
我将使用Instagram的关注api .
设置网址:https://api.instagram.com/v1/users/ / relationship?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时,范围=关系喜欢......数据发送
如何在iOS中使用Instagram关注api .
3 回答
Instagram自2015年4月中旬以来更改了API指南 .
https://help.instagram.com/contact/185819881608116
OAuth 2.0规范允许您指定要从用户请求的访问范围 . 默认情况下,所有应用都具有基本读取权限,但如果您计划要求扩展访问权限(如喜欢,评论或管理友谊),则需要在授权请求中指定这些范围 . Note that in order to use these extended permissions, first you need to submit your app for review. 有关如何提交应用以供审核的详细信息,请查看您计划使用的 endpoints 的文档 .
因此,您需要让 app reviewed by instagram first 使用这些扩展权限,例如Likes,Comments和Relationships .
如您所收到的错误中所述,您需要获得某项权限才能执行“跟进”操作 . 您不能仅代表用户关注其他帐户,而无需在身份验证过程中首先获得适当的权限 .
调用authorize api时,您可以添加一个名为
scope
的参数,该参数指定您的应用正在请求的权限级别 . 例如:scope=basic+relationships
将允许您读取所有基本用户数据,并代表用户关注和取消关注帐户 .这是一个帖子请求 . 要向InstagramAPI发帖请求,您需要将您的申请详情和公司详细信息提交给Instagram进行审核 . 也许其他关系 endpoints 可以正常工作而无需提交您的应用程序 . 即使您将范围添加为范围=喜欢关系评论,Instagram也只会为您提供基本权限 . 有关更多详细信息,请访问以下链接https://instagram.com/developer/endpoints/relationships/#post_relationship