C# Wordnik身份验证错误

C# Wordnik身份验证错误,c#,authentication,C#,Authentication,我正试图使用提供的API从Wordnik检索身份验证令牌。然而,我似乎无法让它发挥作用;我似乎被401和403错误卡住了 以下是我用于从API请求身份验证的代码: string authRequest = String.Format("http://api.wordnik.com//v4/account.json/authenticate/{0}", this.userName); HttpWebRequest request = WebRequest.Create(auth

我正试图使用提供的API从Wordnik检索身份验证令牌。然而,我似乎无法让它发挥作用;我似乎被401和403错误卡住了

以下是我用于从API请求身份验证的代码:

string authRequest = 
    String.Format("http://api.wordnik.com//v4/account.json/authenticate/{0}",
    this.userName);

HttpWebRequest request = WebRequest.Create(authRequest) as HttpWebRequest;
request.Method = WebRequestMethods.Http.Post;
request.ContentType = "application/x-www-form-urlencoded";

// When this is added, I get 403 errors
///request.Headers.Add("api_key", APIKey);

string postData = "password=" + password;
byte[] encodedData = UTF8Encoding.UTF8.GetBytes(postData);
request.ContentLength = encodedData.Length;

Stream stream = request.GetRequestStream();
stream.Write(encodedData, 0, encodedData.Length);
stream.Close();

string responseText;

using(HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
    using(StreamReader reader = new StreamReader(response.GetResponseStream()))
    {
        responseText = reader.ReadToEnd();
        Console.WriteLine(responseText);
        Console.ReadLine();
    }
}
你们谁能告诉我我做错了什么


欢迎任何输入。

请求URL中有一个双斜杠:


似乎没什么不对劲-你试过问吗?这是他们的谷歌群。我在他们群中添加了一篇帖子。谢谢你的帮助。