1
用于交换的access_token时refresh_token我
已经成功与box.com我得到一个错误做到了这一点,在过去的其他服务,但是,我已经试过所有我能想到的关闭,并且其他人在这里建议。错误请求400 box.com
我使用.NET C#;
string postdata = "";
postdata += "client_id=" + HttpUtility.UrlEncode(client_id) + "&";
postdata += "client_secret=" + HttpUtility.UrlEncode(client_secret) + "&";
postdata += "refresh_token=" + HttpUtility.UrlEncode(refreshToken) + "&";
postdata += "redirect_uri=" + HttpUtility.UrlEncode(_redirectUri) + "&";
postdata += "grant_type=refresh_token";
var json = PostResponse(new Uri(@"https://www.box.com/api/oauth2/token"), postdata);
我已经尝试过和没有urlencoding的值。根据我的经验,通常不需要使用urlencoding。 我也尝试了不同的参数顺序。
private string PostResponse(Uri uri, string postdata)
{
var bytes = Encoding.UTF8.GetBytes(postdata);
var request = (HttpWebRequest)WebRequest.Create(uri);
request.Method = WebRequestMethods.Http.Post;
request.ContentType = "application/x-www-form-urlencoded; charset=utf-8";
request.ContentLength = bytes.Length;
Stream OutputStream = request.GetRequestStream();
OutputStream.Write(bytes, 0, bytes.Length);
var response = request.GetResponse();
var reader = new StreamReader(response.GetResponseStream());
return reader.ReadToEnd();
}
此代码失败,错误400(错误的请求)。类似的代码适用于Google Drive等。
任何人能发现我在做什么毛病box.com?谢谢!
我面临同样的问题。你可以添加你如何解决这个问题? – RajeshKdev
我没有。 Box过期刷新令牌的政策使我无法使用他们的服务。我一直在与他们接触,希望他们将开辟一个不太安全的方案,像其他的云解决方案使用(Dropbox的,OneDrive,谷歌驱动器/云打印),其中刷新令牌永不过期。我建议你用相同的请求与他们联系,以便不止一个人通知他们需求。 – bleze
+1并感谢您的回复...好吧当然... – RajeshKdev