1

我使用下面的代码访问 Parse.com 上的 Book 类

    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 响应。我究竟做错了什么 ?

4

1 回答 1

0

我找到了自己问题的答案!

看来所需的密钥(NetworkCredentials 中的第二个参数)应该是主密钥而不是 REST API 密钥。

于 2013-05-06T18:49:22.757 回答