You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OAuth1 signature is generated incorrectly when using non-ASCII symbols in request parameters #1945
Describe the bug
If we use OAuth1 authentication (restClient.Authenticator = OAuth1Authenticator.ForProtectedResource(...)) and have some non-ASCII symbols in our request parameters (it failed when using '£') oauth_signature is generated not correctly.
I think this is because you skipped part of OAuth1 algorithm where we encode our params to UTF-8, it should be done before we URL-encode them. Here is the method that is doing URL-encode:
In the end we have something like this: products%3D%5B%7B%22id%22%3A5%2C%22price%22%3A%22%A355%22%7D%5D
Expected behavior
Starting param: products=[{"id":5,"price":"£55"}]
After UTF-8 encode (e.g. using this site https://cafewebmaster.com/online_tools/utf8_encode) we should have this: products=[{"id":5,"price":"£55"}]
And only after that we need to URL-encode it: products%3D%5B%7B%22id%22%3A5%2C%22price%22%3A%22%C2%A355%22%7D%5D
The difference is we have %C2%A3 instead of %A3.
Desktop:
OS: Windows 11
.NET Framework 4.6.1
Version 108.0.1
Additional context
There is a very useful site for OAuth1 that helped me to find a problem. This is a sandbox that shows the algorithm to generate signature step by step: http://lti.tools/oauth/
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Activity
elia936 commentedon Jan 4, 2023
I experience the same issue. Any update on it?
alexeyzimarev commentedon Mar 29, 2023
@elia936 it's an open source project, if you experience this issue please feel free to submit a pull request to fix it.
stale commentedon May 22, 2023
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
repo-ranger commentedon May 22, 2023
Fixes OAuth1 signature with special characters (restsharp#2126, rests…
Fixes OAuth1 signature with special characters (#2126, #1945) (#2127)