Php 获得;APINotAllowedError“;在私有profil上请求媒体时,即使允许所有作用域
我正在使用PHP Instagram API 我想检索用户的提要,即使他有一个私有profile 首先,我将使用所有授予的作用域生成urlPhp 获得;APINotAllowedError“;在私有profil上请求媒体时,即使允许所有作用域,php,api,instagram,Php,Api,Instagram,我正在使用PHP Instagram API 我想检索用户的提要,即使他有一个私有profile 首先,我将使用所有授予的作用域生成url $instagram->getLoginUrl(array('basic','likes', 'relationships', 'comments')); 然后,一旦用户批准了应用程序,我就尝试检索他的提要 // Grab OAuth callback code $code = $_GET['code']; $data = $instagram-&
$instagram->getLoginUrl(array('basic','likes', 'relationships', 'comments'));
然后,一旦用户批准了应用程序,我就尝试检索他的提要
// Grab OAuth callback code
$code = $_GET['code'];
$data = $instagram->getOAuthToken($code);
// Set token
$instagram->setAccessToken($data->access_token);
// get medias
$medias = $instagram->getUserMedia($data->user->id, -1);
我得到一个APINotAllowedError错误
object(stdClass)#5 (1) {
["meta"]=>
object(stdClass)#6 (3) {
["error_type"]=>
string(18) "APINotAllowedError"
["code"]=>
int(400)
["error_message"]=>
string(29) "you cannot view this resource"
}
}
我做错了什么?多谢各位
更新和修复
好的,实际上它来自PHP库,当前的getUserMedia()失败,因为它没有使用提供的access\u令牌
这是正确的方法
public function getUserMedia($id = 'self', $limit = 0) {
return $this->_makeCall('users/' . $id . '/media/recent', true, array('count' => $limit));
}
谢谢大家! 更新:2016年6月1日之后。您不能再通过API访问私人配置文件,即使您遵循该用户/已获得该用户的批准。您将得到error
apinoallowederror
。如果您正在关注,查看个人资料的唯一方法是使用instagram应用程序或instagram.com
但如果您的个人资料是私有的,您可以使用access\u令牌通过API访问它
如果用户是私有用户,则无法访问配置文件。当使用无权访问用户的访问令牌访问私人用户时,这是正确的响应
{"meta":{"error_type":"APINotAllowedError","code":400,"error_message":"you cannot view this resource"}}
只有使用允许访问用户的用户访问令牌访问API,才能获得正确的响应 查看这些帮助:,将更新作为答案发布