There is already a StackOverflow post that has addressed this issue. However, it couldn't help me.
So, I have written an OpenID login implementation using DotNetOpenAuth and I keep on getting "Message signature was incorrect".
The funny thing is that this is happening from a PC I have at my home. At my work I'm not getting this error and it is working ok.
I've tried to add in the web.config
<trust level="Ful开发者_Python百科l" />
<httpRuntime maxQueryStringLength="20000" />
Also, I've added the null parameter while instantiating the OpenIdRelyingParty
new OpenIdRelyingParty(null)
Lastly, I've opened the 443 port in the router and PC.
The key factor is that this is not working from the PC I have at home. However, it is working from the PC I have at work. Both have the same exact code.
When you make a request to an OAuth provider, the framework generates a signature. This signature is a hash of different values, including the URL that you are requesting. The provider then does the same and performs a comparison. If the hash that the provider builds is not the same as the one you've provided via the oauth_signature query string parameter, the request is not considered valid, and you get this error.
I ran into a similar issue when my client application was signing an URL that was something along the lines of api.foo.com/oauth. The server had an URL rewriter that rewrote the URL to foo.com/api/oauth before the provider had a chance to process anything. Since the client URL and the URL that was processed by the provider were different, this caused different signatures, hence the error.
Check your computer clock. The time should be correct as well as the timezone.
If that doesn't help it, please activate logging and see if it gives you more details about why the signature is wrong.
精彩评论