Skip to content

CONNECT_CODE_INVALID

A store plugin tried to exchange a Connect code for its keys, and the code can’t be used. details.reason says why (see Plugin Connect for the flow):

HTTP status
400 Bad Request
Code
CONNECT_CODE_INVALID
reason What happened
unknown No such code was issued.
used The code was already exchanged. A code works once, and only once.
expired More than 5 minutes passed between approving and exchanging.
verifier The code_verifier is not the one the code’s code_challenge was made from.
site The site_url is not the store the code was issued to.

Every exchange spends the code, right or wrong, so a code that leaked can’t be tried twice. If a code that was already exchanged is presented again, the connection it made is revoked (its keys and webhooks stop at once): only someone replaying the code would send it a second time.

  • Merchants: press Connect intents.fi in your store’s settings again. It takes a few seconds, and nothing from the failed attempt is left behind.
  • Plugin authors: make a fresh state and code_verifier for every attempt, keep the verifier on your server, exchange the code as soon as the browser comes back, send the same site_url you put in the request, and never retry an exchange with the same code.
{ "error": { "code": "CONNECT_CODE_INVALID", "message": "…" } }