oauth_signature invalid error while using Magento Rest API with GET filters












7














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?










share|improve this question
























  • 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
















7














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?










share|improve this question
























  • 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














7












7








7


2





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?










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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


















  • 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










3 Answers
3






active

oldest

votes


















3














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 :)






share|improve this answer





















  • 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



















0














There is an issue with magento core functionality
vendor/magento/framework/Oauth/Oauth.php
Comment out line number 199.






share|improve this answer





























    0














    The trick is you have to convert the square brackets in the signature base string twice:




    • [ => %5B => %255B

    • ] => %5D => %255D






    share|improve this answer








    New contributor




    Thomas Steinhäuser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.


















      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
      });


      }
      });














      draft saved

      draft discarded


















      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









      3














      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 :)






      share|improve this answer





















      • 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
















      3














      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 :)






      share|improve this answer





















      • 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














      3












      3








      3






      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 :)






      share|improve this answer












      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 :)







      share|improve this answer












      share|improve this answer



      share|improve this answer










      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


















      • 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













      0














      There is an issue with magento core functionality
      vendor/magento/framework/Oauth/Oauth.php
      Comment out line number 199.






      share|improve this answer


























        0














        There is an issue with magento core functionality
        vendor/magento/framework/Oauth/Oauth.php
        Comment out line number 199.






        share|improve this answer
























          0












          0








          0






          There is an issue with magento core functionality
          vendor/magento/framework/Oauth/Oauth.php
          Comment out line number 199.






          share|improve this answer












          There is an issue with magento core functionality
          vendor/magento/framework/Oauth/Oauth.php
          Comment out line number 199.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 17 '17 at 12:38









          Sonu KumarSonu Kumar

          1




          1























              0














              The trick is you have to convert the square brackets in the signature base string twice:




              • [ => %5B => %255B

              • ] => %5D => %255D






              share|improve this answer








              New contributor




              Thomas Steinhäuser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.























                0














                The trick is you have to convert the square brackets in the signature base string twice:




                • [ => %5B => %255B

                • ] => %5D => %255D






                share|improve this answer








                New contributor




                Thomas Steinhäuser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.





















                  0












                  0








                  0






                  The trick is you have to convert the square brackets in the signature base string twice:




                  • [ => %5B => %255B

                  • ] => %5D => %255D






                  share|improve this answer








                  New contributor




                  Thomas Steinhäuser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  The trick is you have to convert the square brackets in the signature base string twice:




                  • [ => %5B => %255B

                  • ] => %5D => %255D







                  share|improve this answer








                  New contributor




                  Thomas Steinhäuser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  share|improve this answer



                  share|improve this answer






                  New contributor




                  Thomas Steinhäuser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  answered yesterday









                  Thomas SteinhäuserThomas Steinhäuser

                  1




                  1




                  New contributor




                  Thomas Steinhäuser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





                  New contributor





                  Thomas Steinhäuser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






                  Thomas Steinhäuser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






























                      draft saved

                      draft discarded




















































                      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.




                      draft saved


                      draft discarded














                      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





















































                      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







                      Popular posts from this blog

                      An IMO inspired problem

                      Management

                      Has there ever been an instance of an active nuclear power plant within or near a war zone?