Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/275.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/rest/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 访问PARSE.COM时出现未经授权的错误代码_C#_Rest_Parse Platform - Fatal编程技术网

C# 访问PARSE.COM时出现未经授权的错误代码

C# 访问PARSE.COM时出现未经授权的错误代码,c#,rest,parse-platform,C#,Rest,Parse Platform,我使用下面的代码访问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 webR

我使用下面的代码访问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();
    }
这总是导致未经授权的响应。
我做错了什么

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


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

好吧,我不认为
RestApiKey=“我的REST API密钥”
是有效的密钥。而且
应用程序ID
看起来可疑。当然,除非你在发帖时把这些都删掉了?如果是这样,请忽略以下内容:)在实际代码中有实际值,请从PARSE.COM站点复制粘贴。在发布我的问题时,我把它们屏蔽了。我唯一能说的是确保你的AppId和ApiKey是有效的。401表示您的凭据无效。