php - Getting "APINotAllowedError" when requesting medias on a private profil, even with all scopes allowed -


i'm using php instagram api https://github.com/cosenary/instagram-php-api

i retrieve feed of user, if has private profil.

first, i'm generating url scopes granted

$instagram->getloginurl(array('basic','likes', 'relationships', 'comments')); 

then, once user approved application, try retrieve feed

// grab oauth callback code $code = $_get['code'];  $data = $instagram->getoauthtoken($code);  // set token $instagram->setaccesstoken($data->access_token);    // medias $medias = $instagram->getusermedia($data->user->id, -1); 

i apinotallowederror error

object(stdclass)#5 (1) {   ["meta"]=>   object(stdclass)#6 (3) {     ["error_type"]=>     string(18) "apinotallowederror"     ["code"]=>     int(400)     ["error_message"]=>     string(29) "you cannot view resource"   } } 

what doing wrong? thank much!

update , fix

ok comes php library, current getusermedia() fails because doesn't use access_token provided...

here correct method

public function getusermedia($id = 'self', $limit = 0) {     return $this->_makecall('users/' . $id . '/media/recent', true, array('count' => $limit));   } 

thank you!

update: after june 1, 2016. can no longer access private profile via api if following/approved user. error apinotallowederror. way view private profile if following using instagram app or instagram.com.

but if profile private, can access via api using access_token


you cannot access profile if user private. right response when accessing private user access_token not have access user

{"meta":{"error_type":"apinotallowederror","code":400,"error_message":"you cannot view resource"}} 

you can correct response if access api user's access_token has been allowed access user.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -