C# 如何从codebehind登录Instagram?
我需要在我的网页上显示特定instagram用户的图像 正如Instagram API文档中所述,我需要通过身份验证才能“浏览”用户的提要 “我们仅在您的应用程序代表用户发出请求(评论、喜欢、浏览用户提要等)的情况下才需要身份验证。” () 因此,正如API文档中所述,我向以下URL发送请求:C# 如何从codebehind登录Instagram?,c#,restful-authentication,instagram,C#,Restful Authentication,Instagram,我需要在我的网页上显示特定instagram用户的图像 正如Instagram API文档中所述,我需要通过身份验证才能“浏览”用户的提要 “我们仅在您的应用程序代表用户发出请求(评论、喜欢、浏览用户提要等)的情况下才需要身份验证。” () 因此,正如API文档中所述,我向以下URL发送请求: https://instagram.com/oauth/authorize/?display=touch&client_id=[ClientID] &redirect_uri=[callb
https://instagram.com/oauth/authorize/?display=touch&client_id=[ClientID]
&redirect_uri=[callbackuri]/&response_type=token
要重定向到另一个URL:http://your_redirect_uri?code=CODE
获取访问令牌(代码)以调用instagram RESTful服务
问题是,如果我的网站访问者没有登录Instagram,他/她将被转发到登录页面,首先进行身份验证,然后我才能获得访问令牌
我的问题是:如何通过使用我的应用程序的instagram帐户从codebehind(或者可能通过javascript!)自动登录来绕过这个登录页面
顺便说一下,我正在使用C#和Instasharp()
有什么想法吗
提前谢谢你 在Instagram中创建开发者应用程序的第一步,获取consumerkey和ConsumerCret并设置路径回调url somthing链接 在此页面上自动重定向并调用此代码
public void Instagram()
{
string code = (String)Request.QueryString["code"];
oAuthInstagram objInsta = new oAuthInstagram();
GlobusInstagramLib.Authentication.ConfigurationIns configi = new GlobusInstagramLib.Authentication.ConfigurationIns("https://api.instagram.com/oauth/authorize/", ConfigurationManager.AppSettings["consumerKey"], ConfigurationManager.AppSettings["consumerSecret"], ConfigurationManager.AppSettings["callbackurl"], "http://api.instagram.com/oauth/access_token", "https://api.instagram.com/v1/", "");
oAuthInstagram _api = new oAuthInstagram();
_api = oAuthInstagram.GetInstance(configi);
AccessToken access = new AccessToken();
access = _api.AuthGetAccessToken(code);
string accessToken = access.access_token;
string id =access.user.id;
}
您将获得令牌和用户id
public void Instagram()
{
string code = (String)Request.QueryString["code"];
oAuthInstagram objInsta = new oAuthInstagram();
GlobusInstagramLib.Authentication.ConfigurationIns configi = new GlobusInstagramLib.Authentication.ConfigurationIns("https://api.instagram.com/oauth/authorize/", ConfigurationManager.AppSettings["consumerKey"], ConfigurationManager.AppSettings["consumerSecret"], ConfigurationManager.AppSettings["callbackurl"], "http://api.instagram.com/oauth/access_token", "https://api.instagram.com/v1/", "");
oAuthInstagram _api = new oAuthInstagram();
_api = oAuthInstagram.GetInstance(configi);
AccessToken access = new AccessToken();
access = _api.AuthGetAccessToken(code);
string accessToken = access.access_token;
string id =access.user.id;
}