FROM CACHE - en_header

Oauth callback called twice with same code parameter

Shopify Partner
5 0 2

Hi All.

I'm testing a custom app.

I have noticed that during installation of the app and generally during the oauth flow, the oauth callback url is called twice, with same code, but different timestamp.

There are a few seconds between the calls,

In the first call, I can use the code to get an access token, but during the second call I get the error that the code has been used before or is empty.

I think it has to do with the app loading inside the iframe, since it does not happen if I redirect at the top level, out of the iframe.

Any clues are much appreciated !

Replies 2 (2)
New Member
1 0 0

Getting similar issue - was there a fix?

Shopify Partner
5 0 2

The problem being that you cannot use the same code twice, my workaround was to store the 'code' parameter used to obtain the token, along with the token in my token store.

That way I can filter out and ignore any subsequent calls, using the same code.

As said, probably not the solution, but a workaround 😉