I am using InstaSharp for my ASp.Net MVC application. My problem is every time following code returns null. ( RequestToken(code) always return a OAuthResponse Instance with AccessToken = null , User = null)
OAuthResponse oAuthResponse = await oAuth.RequestToken(code);
So i can t get user id from oAuthResponse. here is my code.
public async Task<IList<Media>> GetInstagramMediaList(string clientId, string clientSecret, string returnUrl, string code)
{
List<Media> mediaResponseList = new List<Media>();
InstagramConfig instagramConfig = new InstagramConfig(clientId, clientSecret, returnUrl, string.Empty);
OAuth oAuth = new OAuth(instagramConfig);
OAuthResponse oAuthResponse = await oAuth.RequestToken(code);
Users users = new Users(instagramConfig, oAuthResponse);
MediasResponse instaResponse = await users.Recent(oAuthResponse.User.Id.ToString());
mediaResponseList.AddRange(instaResponse.Data);
while (instaResponse.Pagination.NextMaxId != null)
{
instaResponse = await users.RecentSelf(maxId: instaResponse.Pagination.NextMaxId, minId: instaResponse.Pagination.NextMinId, count: null, maxTimestamp: null, minTimestamp: null);
mediaResponseList.AddRange(instaResponse.Data);
}
return new List<Media>(mediaResponseList);
}
if any one can give a solution for this it will be a great help to me. Thanks in advance.