401 App Proxy

Highlighted
New Member
1 0 0

Hi, I have unlisted Shopify app and I have setup App Proxy with prefix as "a" and subpath as "customer-meta". I have supplied the full URL of the php file under Proxy URL. I use laravel-shopify for my unlisted app. 

 

On the Shopify's liquid theme, I have an ajax call (GET) to the app proxy. 

 

$.ajax({
        method: "GET",
        crossDomain: true,
        url: "/a/customer-meta",
        data: $("#custmeta").serialize()
      })
      .done(function( response, textStatus, jqXHR ) {
          
          $( "#updatebutton" ).prop("disabled", false);
          $( "#updatebutton" ).html("SAVE / EDIT CHILD");
          
          if(response == 'success'){
            $( "#dialog-message" ).dialog({
              modal: true,
              buttons: {
                Ok: function() {
                  $( this ).dialog( "close" );
                  location.reload();
				}
              }
            });
            
          } else {
            $( "#dialog-error-message" ).dialog({
              modal: true,
              buttons: {
                Ok: function() {
                  $( this ).dialog( "close" );
                }
              }
            });
          }     
      })
      .fail(function( jqXHR, textStatus, errorThrown ) {
          $( "#updatebutton" ).prop("disabled", false);
          $( "#updatebutton" ).html("SAVE / EDIT CHILD");
          
          var errorMessage = jqXHR.status + ': ' + jqXHR.statusText + '\n';
          errorMessage += 'Please check your data and try again. If this error continues, please contact us for assistance.';
          
          alert('Error - ' + errorMessage);
      });

I'm unable to replicate the 401 error message however a lot of my customers are saying they're getting 401 error message ($.ajax.fail condition). I checked my website statistic and there is 63% rate of 401. I'm using offline access token so the token itself shouldn't expire so I'm not sure why some users are getting 401 error and some not. 

 

Any help will be really appreciated. Thanks!

0 Likes
Shopify Staff
Shopify Staff
1296 43 188

If the 401s are occurring on your server, can you indicate exactly where the 401 is occurring? To be more specific, is there a stack trace you can share if it's due to an exception, or is there an HTTP request you're making upstream which is resolving to a 401, which you are sending back to the ajax client? More info is much appreciated.

 

Cheers.

0 Likes