无法在登台环境中获取Instagram的访问令牌

时间:2016-12-13 10:57:32

标签: c# instagram-api oauth2

从昨天开始,我将Instagram帐户与我们的应用程序联系起来时遇到了问题。代码在本地工作正常,但问题只会影响测试/生产环境。

首先,我通过电话检索code

https://api.instagram.com/oauth/authorize/?client_id=[client_id]&redirect_uri=[redirect_uri]&response_type=code&state=[state]&scope=likes+comments+relationships+public_content+basic+follower_list

此调用使用该值进行回调,然后在以下代码块中使用该值:

using (var wb = new WebClient())
{
    var data = new NameValueCollection
                   {
                       ["grant_type"] = "authorization_code",
                       ["client_id"] = _clientId,
                       ["client_secret"] = _clientSecret,
                       ["redirect_uri"] = callbackUrl,
                       ["code"] = code
                   };
    var response = wb.UploadValues("https://api.instagram.com/oauth/access_token", "POST", data);
    return JsonConvert.DeserializeObject<InstagramAccessTokenResponse>(Encoding.Default.GetString(response));
}

此解决方案到目前为止工作正常,但我突然得到了以下回复

  消息:{
      “error_message”:“未找到匹配代码或已使用过匹配代码。”,
      “代码”:400,
      “error_type”:“OAuthException”
  }

任何想法可能是什么原因?

更新

正如一些帖子提到的,经过几天的等待,这个问题解决了,现在又重新开始了,没有改变任何事情。

0 个答案:

没有答案