使用instagram文档我尝试计算用户的subscriber.token列表是否正确返回,但如果我尝试获取用户列表,则总是错误400代码。 如果有人找到了如何解决,请告诉我如何。我尝试使用instasharp,但无法弄清楚如何使用'订阅者输出方法'。互联网没有为初学者解释的好例子。使用库xNet
public string tok = Gettoken();
private void button1_Click(object sender, EventArgs e)
{
File.WriteAllText("tokken.txt", followby());
//MessageBox.Show(Gettoken());
}
public static string Gettoken()
{
string clientID = "**********************";
string clientSecret = "****************";
string redirect_uri = "https://localhost";
var info = "https://api.instagram.com/oauth/authorize/?client_id=" + clientID + "&redirect_uri=" + redirect_uri + "&response_type=token";
var request = new HttpRequest();
request.UserAgent = HttpHelper.ChromeUserAgent();
HttpResponse response = request.Get(string.Format(info));
string str = response.ToString();
string pattern = @"([0-9a-f]{32})";
Regex regex = new Regex(pattern);
Match match = regex.Match(str);
return match.Groups[1].Value.ToString();
}
string followby()
{
var info = "https://api.instagram.com/v1/users/23423443/follows?access_token=" + tok;
var request = new HttpRequest();
request.UserAgent = HttpHelper.ChromeUserAgent();
HttpResponse response = request.Get(string.Format(info)); //error
return response.ToString();
}
答案 0 :(得分:0)
我相信您在获取访问令牌时未包含申请的许可范围。我看到你正试图让用户'关注和跟进列表。为此,您需要在URL中包含"&scope=follower_list"
以获取访问令牌。
用户将被要求您的应用程序正在尝试阅读您的关注列表,如果用户仅批准您可以获得此类数据。