Search code examples
c#instagram-apiinstasharp

InstaSharp authentication without user interaction


I'm trying to write a service, that can get the Instagram feed for a specific user.

Im using InstaSharp, but I can't figure out how to do the authentication without redirecting the end user to a https://api.instagram.com/oauth/authorize url

I can't find any examples, beside this (and others looking like it)

Can anyone give me any pointers. For now I have a Instagram app in sandbox mode, and a selection of users, who have accepted the sandbox invite.


Solution

  • I don't think it's possible with this library. You better generate your access token by yourself - https://elfsight.com/blog/2016/05/how-to-get-instagram-access-token/ and then request user's feed as like this

    https://api.instagram.com/v1/users/{USER-ID}/media/recent/?access_token={YOUR-ACCESS-TOKEN}
    

    If you want to deserialize your JSON object to c#, please use this service - http://json2csharp.com for generating your class and then using Newtownsoft library:

    JsonConvert.DeserializeObject<RootObject>(yourClass)
    

    Good luck.