Search code examples
.netasp.net-mvcasp.net-coreurl-routing

How to Instagram url for user in .net core 2.0


How can I use the Instagram url in my project, for example. https://www.instagram.com/tom


Solution

    1. To access a specific user's feed through the Instagram API you must first register a new Instagram OAuth Client at http://instagram.com/developer/clients/register which your website will use to access the API.
    2. Next you need to grant permission to the new application to access the Instagram API on your behalf, the easiest way to do this is by going to the Instagram authorization URL below, just replace the querystring parameters CLIENT-ID and REDIRECT-URI with the values from your client application:

    3. You'll be prompted to give access to the application, then you'll be redirected back to the REDIRECT-URI with an access token appended to the end in the url fragment,

    4. There are a couple of NuGet packages you can use to access the Instagram API, I went with the Skybrud.Social package because it looked easy to use, and it was, I was able to get the 9 latest images from a user feed with the following C# code in my MVC4 controller:

    Full detail with example you can find here: https://www.pointblankdevelopment.com.au/blog/126/display-instagram-user-feed-on-your-website-with-c-and-aspnet-mvc4