ripper234
ripper234

Reputation: 230008

Sporadic invalid_request 400 errors connecting to Shopify /admin/oauth/access_token

I am using a java raw HTTP client to connect to Shopify API (specifically, using Play Framework with the non-defualt sync driver which is actually the JDK's default driver).

My application usually manages to connect successfully and convert the temporary access token into a permanent one by calling the /admin/oauth/access_token endpoint.

However, sometimes I get this error result from the API:

Generic Error(400)
{"error":"invalid_request"}

I haven't been able to reproduce the issue with my test stores - I've tried installing a fresh store, reinstalling existing stores after uninstalling, I'm not sure why this call sometimes fail and how to debug it. The API call still continues to succeed for some stores using our application.

Some things that I am doing:

  1. Even if the URL of the store is on a custom domain, I'm always using the https://foo.myshopfiy.com/admin/oauth/access_token URL and not the URL of the custom domain, to prevent a redirect.
  2. I am always using an https URL and never an http one, again to prevent a redirect (we noticed a few issues with redirect with the Java HTTP client, so we aim to have zero redirects)
  3. A thread I found about this error suggest possible problems with our SSL certificates, however I don't think this is my problem because some requests work for us, and the result of running openssl on our machine does't show any issues.

How should I proceed? Open a support ticket with Shopify?

FYI, I see that this specific problem only started yesterday on Feb 19 2013, so it might be a temporary issue.

Upvotes: 2

Views: 1333

Answers (1)

ripper234
ripper234

Reputation: 230008

FYI, the problem was caused by reusing a temporary access code.

Our fault - Shopify could have been more clear in their error message though.

Upvotes: 2

Related Questions