On App Install, redirect URL gets called twice intermittently (only on Chrome)

Topic summary

A developer is experiencing an intermittent issue with their Shopify-approved public app installation, occurring in approximately 4 out of 9 attempts—exclusively on Chrome browser, though Chrome installations also succeed sometimes.

Expected vs. Actual Behavior:

  • Expected: User clicks install → app receives offline token from redirect URL → user redirected to create account
  • Actual: The redirect URL gets called twice, causing the authorization token to be used twice and triggering the error “The authorization code was not found or was already used”

Key Details:

  • Issue is browser-specific but inconsistent (Chrome fails 4/9 times, succeeds 5/9 times)
  • Problem appears related to duplicate redirect URL calls during the OAuth flow
  • Developer is seeking solutions to prevent this double-call behavior
Summarized with AI on November 4. AI used: claude-sonnet-4-5-20250929.

I have a public app approved by Shopify review team. When I try to install this app, sometimes (4 out of 9 attempts) will be unsuccessful. All unsuccessful attempts are when installed on Chrome. However, 3 out of the 5 successful attempts were also from Chrome, so Chrome doesn’t always fail to install the app.

Expected behavior:
When I click on install on the app page, I have logic to get a Shopify offline token from the redirect URL. Once this token is received, user will be redirected to the app site to create an account.
Actual behavior:
When I press the install button on the app page, it somehow calls the redirect URL twice so the authorization token seems used and I get the error: ‘The authorization code was not found or was already used’.

Any ideas what I can do to resolve this issue?