Login in instagram using Instasharp in c#

Hi,

Do you want to do login functionality on Instagram for your website using c#?

[Ignore this step if you have created application in Instagram]
Step 1: Create an application in Instagram to communicate from your website.
http://narendrajarad.blogspot.in/2014/07/create-application-in-instagram.html

First, you need to create two pages. Let's have an example.
1) Default.aspx
2) Response.aspx



Use this code to "Login functionality of Instagram for your website using c#". After successfully log in you will get "code" at response.aspx page in query string.

Use this below code for Instagram login using C#:
var clientId = "YOUR CLIENT ID";
var clientSecret = "YOUR CLIENT SECRET"
var redirectUri = "http://localhost:*****/Response.aspx";
var realtimeUri = "";

var config = new InstaSharp.InstagramConfig("https://api.instagram.com/v1/", "https://api.instagram.com/oauth/", clientId, clientSecret, redirectUri);

Context.Session.Add("InstaSharp.Config", config);

var accessUrl = string.Format("https://instagram.com/oauth/authorize/?client_id={0}&redirect_uri={1}&response_type=code",
        clientId, redirectUri);

Response.Redirect(accessUrl);

Comments