oauth_signature invalid error while using Magento Rest API with GET filters
I'm having a hard time fetching orders from Magento REST API when I use its GET filters like http://localhost/magento/api/rest/orders/?filter[1][attribute]=entity_id&filter[1][gt]=70&page=1&limit=100
It is giving a "error":[{"code":401,"message":"oauth_problem=signature_invalid"}]
When I try hitting the same API endpoint using a REST Client like Postman, I'm getting back the desired results JSON.
I suspect the square brackets in the filter query might be causing a problem in generating a Oauth signature. All the endpoints without GET filters are working fine. I'm using the Request node module to make the GET request with the oauth headers.
Is there any fix to avoid the signature invalid error?
magento-1.9 oauth
|
show 3 more comments
I'm having a hard time fetching orders from Magento REST API when I use its GET filters like http://localhost/magento/api/rest/orders/?filter[1][attribute]=entity_id&filter[1][gt]=70&page=1&limit=100
It is giving a "error":[{"code":401,"message":"oauth_problem=signature_invalid"}]
When I try hitting the same API endpoint using a REST Client like Postman, I'm getting back the desired results JSON.
I suspect the square brackets in the filter query might be causing a problem in generating a Oauth signature. All the endpoints without GET filters are working fine. I'm using the Request node module to make the GET request with the oauth headers.
Is there any fix to avoid the signature invalid error?
magento-1.9 oauth
Is there any answer on this question or did you find a way to apply filter? i am also facing same problem
– UmeshR
Apr 26 '15 at 9:05
The problem was within the Request node module I was using to generate a OAuth signature.It didn't factor for square brackets in the URL. I modified the code in the module for including square brackets. Check the OAuth signature generation method you are using.
– srikanth
Apr 27 '15 at 17:03
that is right after some time spend i got it resolved, thank you for your pointers.
– UmeshR
Apr 30 '15 at 6:46
I have the same problem. If the querystring contains square brackets the signature is invalid. How did you get to solve it? Thanks you.
– user40053
May 20 '16 at 16:46
I am also having the same problem. How did you solved? The square brackets is encoding corretly and the querystring parameters order is ok but I still getting invalid signature.
– Gustavo Piucco
Jul 4 '16 at 12:54
|
show 3 more comments
I'm having a hard time fetching orders from Magento REST API when I use its GET filters like http://localhost/magento/api/rest/orders/?filter[1][attribute]=entity_id&filter[1][gt]=70&page=1&limit=100
It is giving a "error":[{"code":401,"message":"oauth_problem=signature_invalid"}]
When I try hitting the same API endpoint using a REST Client like Postman, I'm getting back the desired results JSON.
I suspect the square brackets in the filter query might be causing a problem in generating a Oauth signature. All the endpoints without GET filters are working fine. I'm using the Request node module to make the GET request with the oauth headers.
Is there any fix to avoid the signature invalid error?
magento-1.9 oauth
I'm having a hard time fetching orders from Magento REST API when I use its GET filters like http://localhost/magento/api/rest/orders/?filter[1][attribute]=entity_id&filter[1][gt]=70&page=1&limit=100
It is giving a "error":[{"code":401,"message":"oauth_problem=signature_invalid"}]
When I try hitting the same API endpoint using a REST Client like Postman, I'm getting back the desired results JSON.
I suspect the square brackets in the filter query might be causing a problem in generating a Oauth signature. All the endpoints without GET filters are working fine. I'm using the Request node module to make the GET request with the oauth headers.
Is there any fix to avoid the signature invalid error?
magento-1.9 oauth
magento-1.9 oauth
edited Apr 6 '15 at 15:58
Amit Bera♦
57.3k1474171
57.3k1474171
asked Apr 6 '15 at 15:14
srikanthsrikanth
3613
3613
Is there any answer on this question or did you find a way to apply filter? i am also facing same problem
– UmeshR
Apr 26 '15 at 9:05
The problem was within the Request node module I was using to generate a OAuth signature.It didn't factor for square brackets in the URL. I modified the code in the module for including square brackets. Check the OAuth signature generation method you are using.
– srikanth
Apr 27 '15 at 17:03
that is right after some time spend i got it resolved, thank you for your pointers.
– UmeshR
Apr 30 '15 at 6:46
I have the same problem. If the querystring contains square brackets the signature is invalid. How did you get to solve it? Thanks you.
– user40053
May 20 '16 at 16:46
I am also having the same problem. How did you solved? The square brackets is encoding corretly and the querystring parameters order is ok but I still getting invalid signature.
– Gustavo Piucco
Jul 4 '16 at 12:54
|
show 3 more comments
Is there any answer on this question or did you find a way to apply filter? i am also facing same problem
– UmeshR
Apr 26 '15 at 9:05
The problem was within the Request node module I was using to generate a OAuth signature.It didn't factor for square brackets in the URL. I modified the code in the module for including square brackets. Check the OAuth signature generation method you are using.
– srikanth
Apr 27 '15 at 17:03
that is right after some time spend i got it resolved, thank you for your pointers.
– UmeshR
Apr 30 '15 at 6:46
I have the same problem. If the querystring contains square brackets the signature is invalid. How did you get to solve it? Thanks you.
– user40053
May 20 '16 at 16:46
I am also having the same problem. How did you solved? The square brackets is encoding corretly and the querystring parameters order is ok but I still getting invalid signature.
– Gustavo Piucco
Jul 4 '16 at 12:54
Is there any answer on this question or did you find a way to apply filter? i am also facing same problem
– UmeshR
Apr 26 '15 at 9:05
Is there any answer on this question or did you find a way to apply filter? i am also facing same problem
– UmeshR
Apr 26 '15 at 9:05
The problem was within the Request node module I was using to generate a OAuth signature.It didn't factor for square brackets in the URL. I modified the code in the module for including square brackets. Check the OAuth signature generation method you are using.
– srikanth
Apr 27 '15 at 17:03
The problem was within the Request node module I was using to generate a OAuth signature.It didn't factor for square brackets in the URL. I modified the code in the module for including square brackets. Check the OAuth signature generation method you are using.
– srikanth
Apr 27 '15 at 17:03
that is right after some time spend i got it resolved, thank you for your pointers.
– UmeshR
Apr 30 '15 at 6:46
that is right after some time spend i got it resolved, thank you for your pointers.
– UmeshR
Apr 30 '15 at 6:46
I have the same problem. If the querystring contains square brackets the signature is invalid. How did you get to solve it? Thanks you.
– user40053
May 20 '16 at 16:46
I have the same problem. If the querystring contains square brackets the signature is invalid. How did you get to solve it? Thanks you.
– user40053
May 20 '16 at 16:46
I am also having the same problem. How did you solved? The square brackets is encoding corretly and the querystring parameters order is ok but I still getting invalid signature.
– Gustavo Piucco
Jul 4 '16 at 12:54
I am also having the same problem. How did you solved? The square brackets is encoding corretly and the querystring parameters order is ok but I still getting invalid signature.
– Gustavo Piucco
Jul 4 '16 at 12:54
|
show 3 more comments
3 Answers
3
active
oldest
votes
Did you managed to Encode the names and values of parameters?
I was having this issue too and this helped me.
You have to make sure that your signature base string parameters are in alphabetic order by parameter name
This is what i'm using to encode parameters in my signature base.
var result = new StringBuilder();
string webUnreservedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~";
foreach (char symbol in url)
{
if (webUnreservedChars.IndexOf(symbol) != -1)
result.Append(symbol);
else
result.Append('%' + ((int)symbol).ToString("X2"));
}
return result.ToString();
Hope this helps :)
Welcome on Magento SE. Thanks for your answer. Although it is an answer to an old question, it may still be useful to others :)
– Julien Lachal
Nov 12 '15 at 17:03
add a comment |
There is an issue with magento core functionality
vendor/magento/framework/Oauth/Oauth.php
Comment out line number 199.
add a comment |
The trick is you have to convert the square brackets in the signature base string twice:
- [ => %5B => %255B
- ] => %5D => %255D
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f62873%2foauth-signature-invalid-error-while-using-magento-rest-api-with-get-filters%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Did you managed to Encode the names and values of parameters?
I was having this issue too and this helped me.
You have to make sure that your signature base string parameters are in alphabetic order by parameter name
This is what i'm using to encode parameters in my signature base.
var result = new StringBuilder();
string webUnreservedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~";
foreach (char symbol in url)
{
if (webUnreservedChars.IndexOf(symbol) != -1)
result.Append(symbol);
else
result.Append('%' + ((int)symbol).ToString("X2"));
}
return result.ToString();
Hope this helps :)
Welcome on Magento SE. Thanks for your answer. Although it is an answer to an old question, it may still be useful to others :)
– Julien Lachal
Nov 12 '15 at 17:03
add a comment |
Did you managed to Encode the names and values of parameters?
I was having this issue too and this helped me.
You have to make sure that your signature base string parameters are in alphabetic order by parameter name
This is what i'm using to encode parameters in my signature base.
var result = new StringBuilder();
string webUnreservedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~";
foreach (char symbol in url)
{
if (webUnreservedChars.IndexOf(symbol) != -1)
result.Append(symbol);
else
result.Append('%' + ((int)symbol).ToString("X2"));
}
return result.ToString();
Hope this helps :)
Welcome on Magento SE. Thanks for your answer. Although it is an answer to an old question, it may still be useful to others :)
– Julien Lachal
Nov 12 '15 at 17:03
add a comment |
Did you managed to Encode the names and values of parameters?
I was having this issue too and this helped me.
You have to make sure that your signature base string parameters are in alphabetic order by parameter name
This is what i'm using to encode parameters in my signature base.
var result = new StringBuilder();
string webUnreservedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~";
foreach (char symbol in url)
{
if (webUnreservedChars.IndexOf(symbol) != -1)
result.Append(symbol);
else
result.Append('%' + ((int)symbol).ToString("X2"));
}
return result.ToString();
Hope this helps :)
Did you managed to Encode the names and values of parameters?
I was having this issue too and this helped me.
You have to make sure that your signature base string parameters are in alphabetic order by parameter name
This is what i'm using to encode parameters in my signature base.
var result = new StringBuilder();
string webUnreservedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~";
foreach (char symbol in url)
{
if (webUnreservedChars.IndexOf(symbol) != -1)
result.Append(symbol);
else
result.Append('%' + ((int)symbol).ToString("X2"));
}
return result.ToString();
Hope this helps :)
answered Nov 12 '15 at 16:55
Johnny SantosJohnny Santos
312
312
Welcome on Magento SE. Thanks for your answer. Although it is an answer to an old question, it may still be useful to others :)
– Julien Lachal
Nov 12 '15 at 17:03
add a comment |
Welcome on Magento SE. Thanks for your answer. Although it is an answer to an old question, it may still be useful to others :)
– Julien Lachal
Nov 12 '15 at 17:03
Welcome on Magento SE. Thanks for your answer. Although it is an answer to an old question, it may still be useful to others :)
– Julien Lachal
Nov 12 '15 at 17:03
Welcome on Magento SE. Thanks for your answer. Although it is an answer to an old question, it may still be useful to others :)
– Julien Lachal
Nov 12 '15 at 17:03
add a comment |
There is an issue with magento core functionality
vendor/magento/framework/Oauth/Oauth.php
Comment out line number 199.
add a comment |
There is an issue with magento core functionality
vendor/magento/framework/Oauth/Oauth.php
Comment out line number 199.
add a comment |
There is an issue with magento core functionality
vendor/magento/framework/Oauth/Oauth.php
Comment out line number 199.
There is an issue with magento core functionality
vendor/magento/framework/Oauth/Oauth.php
Comment out line number 199.
answered Apr 17 '17 at 12:38
Sonu KumarSonu Kumar
1
1
add a comment |
add a comment |
The trick is you have to convert the square brackets in the signature base string twice:
- [ => %5B => %255B
- ] => %5D => %255D
New contributor
add a comment |
The trick is you have to convert the square brackets in the signature base string twice:
- [ => %5B => %255B
- ] => %5D => %255D
New contributor
add a comment |
The trick is you have to convert the square brackets in the signature base string twice:
- [ => %5B => %255B
- ] => %5D => %255D
New contributor
The trick is you have to convert the square brackets in the signature base string twice:
- [ => %5B => %255B
- ] => %5D => %255D
New contributor
New contributor
answered yesterday
Thomas SteinhäuserThomas Steinhäuser
1
1
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f62873%2foauth-signature-invalid-error-while-using-magento-rest-api-with-get-filters%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Is there any answer on this question or did you find a way to apply filter? i am also facing same problem
– UmeshR
Apr 26 '15 at 9:05
The problem was within the Request node module I was using to generate a OAuth signature.It didn't factor for square brackets in the URL. I modified the code in the module for including square brackets. Check the OAuth signature generation method you are using.
– srikanth
Apr 27 '15 at 17:03
that is right after some time spend i got it resolved, thank you for your pointers.
– UmeshR
Apr 30 '15 at 6:46
I have the same problem. If the querystring contains square brackets the signature is invalid. How did you get to solve it? Thanks you.
– user40053
May 20 '16 at 16:46
I am also having the same problem. How did you solved? The square brackets is encoding corretly and the querystring parameters order is ok but I still getting invalid signature.
– Gustavo Piucco
Jul 4 '16 at 12:54