Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I used this successfully:</p> <pre><code>public Boolean ValidateSignature(String method, Uri url) { String normalizedUrl, normalizedRequestParameters; List&lt;QueryParameter&gt; parameters = new List&lt;QueryParameter&gt;(); parameters.AddRange(GetQueryParameters(url.Query)); var sigParam = parameters.Find(p =&gt; p.Name == OAuthSignatureKey); if (sigParam == null) return false; var expected = sigParam.Value; parameters.Remove(parameters.Find(p =&gt; p.Name == OAuthSignatureKey)); parameters.Sort(new QueryParameterComparer()); normalizedUrl = string.Format("{0}://{1}", url.Scheme, url.Host); if (!((url.Scheme == "http" &amp;&amp; url.Port == 80) || (url.Scheme == "https" &amp;&amp; url.Port == 443))) { normalizedUrl += ":" + url.Port; } normalizedUrl += url.AbsolutePath; normalizedRequestParameters = NormalizeRequestParameters(parameters); StringBuilder signatureBase = new StringBuilder(); signatureBase.AppendFormat("{0}&amp;", method.ToUpper()); signatureBase.AppendFormat("{0}&amp;", UrlEncode(normalizedUrl)); signatureBase.AppendFormat("{0}", UrlEncode(normalizedRequestParameters)); HMACSHA1 hmacsha1 = new HMACSHA1(); hmacsha1.Key = Encoding.ASCII.GetBytes(string.Format("{0}&amp;{1}", UrlEncode(ConsumerSecret), ""));//string.IsNullOrEmpty(tokenSecret) ? "" : UrlEncode(tokenSecret))); var computed = GenerateSignatureUsingHash(signatureBase.ToString(), hmacsha1); return expected == UrlEncode(computed); } </code></pre> <p>together with the code you can find here: <a href="http://oauth.googlecode.com/svn/code/csharp/OAuthBase.cs" rel="nofollow">http://oauth.googlecode.com/svn/code/csharp/OAuthBase.cs</a></p> <p><strong>EDIT</strong>: when making requests and sending parameters via get or post this did not work. What seems to be the problem is that Gmail sorts the parameters with uppercase characters coming first. I resorted to only use lowercase parameters but you could easily fix the code to make sure uppercase comes before lowercase.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload