Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/321.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# flickr oauth签名无效错误_C# - Fatal编程技术网

C# flickr oauth签名无效错误

C# flickr oauth签名无效错误,c#,C#,我正在使用OauthBase.cs类生成签名,但不断收到一个错误,指出签名无效。谁能告诉我哪里出了问题 我临时将其显示在消息框中,并将其复制和粘贴到浏览器中以将其签出 这是我的密码 string consumerKey = "consumer_key"; string consumerSecret = "consumer_secret"; string normalizedUrl = null; string normalized

我正在使用OauthBase.cs类生成签名,但不断收到一个错误,指出签名无效。谁能告诉我哪里出了问题

我临时将其显示在消息框中,并将其复制和粘贴到浏览器中以将其签出

这是我的密码

        string consumerKey = "consumer_key";
        string consumerSecret = "consumer_secret";

        string normalizedUrl = null;
        string normalizedRequestParameters = null;


        Uri url = new Uri("http://www.flickr.com/services/oauth/request_token");
        oAuthBase oAuth = new oAuthBase();

        string nonce = oAuth.GenerateNonce();
        string timeStamp = oAuth.GenerateTimeStamp();
        string callback = oAuth.UrlEncode("http://www.example.com");
        string sig = oAuth.GenerateSignature(url, consumerKey, consumerSecret, string.Empty   , string.Empty , "GET", timeStamp, nonce, callback , oAuthBase.SignatureTypes.HMACSHA1,out normalizedUrl ,out normalizedRequestParameters );
        sig = HttpUtility.UrlEncode(sig);
        StringBuilder sb = new StringBuilder(url.ToString());


        sb.AppendFormat("?oauth_nonce={0}&", nonce);
        sb.AppendFormat("oauth_timestamp={0}&", timeStamp);
        sb.AppendFormat("oauth_consumer_key={0}&", consumerKey);
        sb.AppendFormat("oauth_signature_method={0}&", "HMAC-SHA1");           

        sb.AppendFormat("oauth_version={0}&", "1.0");

        sb.AppendFormat("oauth_signature={0}", sig);
        sb.AppendFormat("oauth_callback={0}", callback);


        MessageBox.Show(sb.ToString());

从昨天起我就一直在做同样的事情。不管我做了什么,我总是得到无效的签名

然后我试着使用,效果很好。我可以推荐你用这个。或者可以查看源代码,预取有助于您发现代码中的问题


希望这对你有所帮助:)

看看下面的帖子。它可能会帮助你flickrnet工作,但是我的应用程序大小会增加,因为我不需要它列出的所有类,所以我尝试使用oAuthBase类。