我使用下面的代码访问Parse.com上的课程
public void GetBook()
{
string RequestString = "https://api.parse.com/1/classes/Book";
string ApplicationId = "my Application ID";
string RestApiKey = "my REST API Key";
WebRequest webRequest = WebRequest.Create(RequestString);
NetworkCredential streetCred = new NetworkCredential(ApplicationId, RestApiKey);
webRequest.Credentials = streetCred;
webRequest.Method = "GET";
webRequest.Timeout = 100000;
HttpWebResponse b = (HttpWebResponse)webRequest.GetResponse();
}
这总是导致401 Unauthorized响应。 我究竟做错了什么 ?
答案 0 :(得分:0)
我找到了自己问题的答案!
似乎所需的密钥(NetworkCredentials中的第二个参数)应该是主密钥而不是REST API密钥。