Instagram API Bad request - asp.net

I have a web application allowing users to login by their instagram account.
I've registered my app to Instagram.
When the user clicks the login button, I direct him to instagram page to login:
https://instagram.com/oauth/authorize/?scope=basic+relationships&client_id={MyClientId}&redirect_uri={My call back aspx page}&response_type=token
After getting access token, I try to get user's followers by sending a GET request to this link:
https://api.instagram.com/v1/users/201199350/follows?access_token={The access token i've got from the previous step}
For my account (which is the account the application registered with) it works perfect.
But the problem occurs when I try to get the 'follows' from other account.
I get 'Bad request 400' error.
How can I solve this issue?
Thank you !!

This is unsolved issue because error 400 means, that user not allowed or not found (deleted by spam/bot system). Also you cannot get followers of private user, if an authentication user is not follower of him.
For the authentication users from first link you can use https://api.instagram.com/v1/users/self/follows?access_token={The access token i've got from the previous step} link.

Related

How do I acquire an OAuth 2.0 Access Token with the r_ads_gen_automation permission for accessing LinkedIn leads for a company page?

My end goal is to register my API to receive notifications of leads generated by LinkedIn for my business's Company Page. The docs here say I need to register at https://api.linkedin.com/v2/leadNotificationUrls using the r_ads_ge_automation permission. I'm trying to acquire this type of access token by using a web browser to hit https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=client_id_for_my_application&redirect_uri=https://my.company.net/api/oauth/linkedin&state=Testing12345&scope=r_ads_leadgen_automation, then logging in as a user that is an admin for the respective company page, then acquiring authentication code, and finally requesting an access token.
The problem is that when I try to hit https://www.linkedin.com/oauth/v2/authorization (with the query params above), I get an error response stating "r_ads_leadgen is not authorized for your application". I can't find any kind of application configuration that is supposed to give this permission to my application.
Can anyone help? Thank you
Permissions are offered to select Partners only. Have you applied to a Partner Program https://business.linkedin.com/marketing-solutions/marketing-partners/become-a-partner?

User not found, or token is not authorized in R

Getting likes from facebook using following command
x <- getLikes(XXX, token=token)
XXX is the user ID of facebook account of person and token is created by Graph API Explorer.
Using this command, I find like activity of user and user's friend account. Out of 10 friends, I got the following Error for some users
likes <- getLikes(XXX, token=token)
Error in getLikes(XXX, token = token) :
User not found, or token is not authorized.
I create new token also but still I get same Error.
Please tell me what should I do to resolve this.
While authorizing a user are you enabling extended permissions as true?
If not, then you have to enable extended permissions as follows
fbOAuth(app_id="Your_app_id",app_secret="your_app_secret",extended_permissions=TRUE)
Once you do this the getLikes function should work properly for all users
It isn't working for you because facebook has stopped the service. Unless the user that you are requesting details from authorizes your application, you wont be getting the data

How to refresh Linkedin oauth token if the user authorized the app through oauth2 authorization?

I need to refresh the user linkedin access token without them having to go through the initial authorization process all over again. I have also looked at this documentation http://developer.linkedin.com/documents/exchange-jsapi-tokens-rest-api-oauth-tokens, but It doesn't work because my users authorize the app through regular OAuth and the article uses the JS OAuth. (Not sure, if there is a difference between two processes, and if there is a difference between access tokens received from each process). Even though, I'm already logged in another tab on the same browser,
it always prompts me to login to LinkedIn.
If I try IN.User.isAuthorized() it returns false though I'm logged in into LinkedIn and I can't seem to be able to refresh the token.
If I pass the user LinkedIn access token from my server to the JS and the user LinkedIn id IN.User.isAuthorized() always returns true even when I'm not logged in
So what I'm trying to ask is, is there a way to refresh the user linkedin oauth token thorguh JS when the user is logged in to linkedin on the same broswer like we are able do for facebook ? and what is it ?
You cannot refresh the token without the member being at your application.
If you want to refresh the token, the member needs to be there and you need to direct them through the authorization page. If they're signed in to LinkedIn, this will be a seamless refresh and we'll redirect page to your application.

Detecting facebook logout from iframe application

How can i found in an iframe application whether the user is already logged in or not.
I am initially authorizing the user and got the access token and store the fb profile id in Session variable. But i am not able to find out if a user logged out from facebook after that.
Can someone help me to find out how we can do this?
You would use the Facebook Javascript SDK and call FB.getLoginStatus(). Another option would be to call the Facebook graph api with the access token you are storing in session and see if that access token is still valid.

Not getting into the callback url

I am using oauth in my web application to access Twitter. My problem is i am not getting the token secret and moreover when i run my application it asks the user for authorization request. when the user click "allow', it does not go back to the called url. Infact it shows a blank untitled page with a url having oauth _token value and oauth_verifier value.
Can someone throw light on this.
Before you send users to twitter.com to authorized the app you need to save the request token secret. When the users clicks allow they will return to the callback url you specify. Once there you need to use the request token/secret to get an access token from twitter that will let you perform API requests as a user.
http://dev.twitter.com/doc/post/oauth/access_token

Resources