Error flickr oauth invalid error

I use the OauthBase.cs class to generate a signature, but I constantly get an error message indicating that the signature is not valid. Can someone tell me where I am going wrong?

I temporarily show it in a message box, copying and pasting it in a browser to check it.

Here is my code ..

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()); 
+4
source share
1 answer

I am working on the same thing as yesterday. No matter what I did, I kept getting invalid_signature.

Instead, I tried using http://flickrnet.codeplex.com/ , which works great. I can recommend this to you. Or maybe look in the source code, presumably this will help you find a problem with your code.

Hope this helps you :)

0
source

Source: https://habr.com/ru/post/1488217/


All Articles