POST returns 200 and Login page

Highlighted
New Member
2 0 0

Hi,

when I fire POST request to any Shopify API endpoint with Private app credentials I am getting HTML "Please log in" page and status code 200. Also this POST request doesn't make any changes, no new ScriptTags/Collections/... are added. GET is working fine and POST was also fine until recently. Did anything changed?

By the way, the Private application has full read/write permissions and I was using the same credentials on the same endpoints and it worked correctly a few days back.

 

Thanks.

0 Likes
Highlighted
Shopify Partner
5 0 0

hi,

I am also getting the same error since day before yesterday. otherwise it was working fine.

 

0 Likes
Highlighted
New Member
5 0 0

Am getting the same since yesterday - any solutions for this?

In my case GET and PUT are ok - just the POST request is failing. Has been working for months.

0 Likes
Highlighted
Tourist
8 0 2

Hi Petr.

I was just facing a similar problem.
The problem was that my POST request contained cookies.

Take a look at this thread.

https://ecommerce.shopify.com/c/shopify-apis-and-technology/t/error-posting-to-order-fulfillments-41...

1 Like
Highlighted
Shopify Staff
Shopify Staff
619 48 94

Hi guys,

We made a change that caused POST requests made using basic auth to return the error you are seeing if they the request is passing cookies. The solution is to either not pass any cookies in the request, or pass X-Shopify-Access-Token: {access_token} in the header. Here's our announcement post for this change: https://ecommerce.shopify.com/c/api-announcements/t/shopify-now-prevents-http-basic-auth-post-reques....

Cheers,

0 Likes
Highlighted
New Member
13 0 0

So how does a private app that used to work with just api key, can get a oauth token now? When i try the command i get 

Oauth error invalid_request: The Shopify API application does not support oauth

for my private app. Now do I have to convert it to public app so I can get the oauth and post data??

How did everybody else solved this problem?

0 Likes
Highlighted
Shopify Partner
15 0 0

X-Shopify-Access-Token is not working on private app. It still returns login page

0 Likes
Highlighted
Tourist
3 0 2

I was having the same issue - POST request from a private app - I was able to do it successfully after adding this line to my request:

HttpRequest.setRequestHeader("Cache-Control","max-age=0")

EDIT:

  • I also switched from MSXML2.XMLHTTP to MSXML2.ServerXMLHTTP
  • Also added basic auth in the header i.e: HttpRequest.setRequestHeader("Authorization","Basic " & Base64EncodeString(API_Key & ":" & Password))
0 Likes
Highlighted
Shopify Expert
14 0 3

C# - quick workaround:


var httpClient = new HttpClient(new HttpClientHandler
{
     UseCookies = false
});

 

This turns off cookies - surprisingly this worked - and did confirm that the Http Client was enabling cookies as all our requests worked instantly from this point onwards.

Referenced Shopify update: https://community.shopify.com/c/API-Announcements/Shopify-now-prevents-HTTP-Basic-Auth-POST-requests...

META - Shopify Experts
www.meta.co.uk
0 Likes
Highlighted
New Member
1 0 0

Just a quick note to add that if you testing in Postman you can go to Settings and turn off Cookie Jar and this fixes the issue as well.

0 Likes