简体   繁体   中英

How to get User Followers in Instagram API?

I am using instagram API(oauth) and I able to get the access token and user information using

https://api.instagram.com/oauth/authorize/client_id='.$client_id.'&redirect_uri='.$redirect_url .'&response_type=code'

and https://api.instagram.com/oauth/access_token by passing client id, secret and redirect_uri.

when I make the first call (https://api.instagram.com/oauth/authorize/client_id='.$client_id.'&redirect_uri='.$redirect_url .'&response_type=code') it gives me the array of access_token and user.

My question is what should I do to get the followers of the user ?

I know I have to use https://api.instagram.com/v1/users/{user-id}/follows?access_token=ACCESS-TOKEN but for some reason I am getting the error message

{
 "code": 400, 
 "error_type": "OAuthException", 
 "error_message": "Only response type \"code\" and \"token\" is allowed"
}

Please help!!!

Firstly, you don't need to be authenticated (ie need an access_token ) to get a list of user followers. You just need your client_id .

The following request should work in your case:

https://api.instagram.com/v1/users/{user-id}/follows/?client_id={client_id}

As per new update you have to use access token instead of client_id

this is my response {"data": {"id": "1829538552", "username": "mypageusername", "profile_picture": " https://scontent.cdninstagram.com/t51.2885-19/11084945_1580533368872297_743341297_a.jpg ", "full_name": "pagename Nation", "bio": "For Business/Ads\\add@gmail.com\\nKik: @test", "website": " https://carsmydrug.myshopify.com/ ", "counts": {"media": 371, "follows": 6464, "followed_by": 171599}}, "meta": {"code": 200}}

this is url to get above response https://api.instagram.com/v1/users/1829538552/?access_token=1829538552.81758e8.5d303d9dd94543efb17684dee425cb5a

You have to get access token and you can only check follower list of user that accepted your of sandbox user

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM