Python Oauth Flow issue

Topic summary

Issue: OAuth setup for Shopify Admin API using FastAPI fails because the callback/request lacks the required ‘code’ query parameter.

Context:

  • Developer is new to Shopify, finds the Python REST library outdated, and is building an inventory tracker.
  • Stack: FastAPI, ngrok for HTTPS tunneling.
  • Goal: verify initial JWT (JSON Web Token), GET order data from Shopify, and establish a session token.

Error:

  • Response: {“detail”: [{“type”: “missing”, “loc”: [“query”, “code”], “msg”: “Field required”, “input”: null}]}
  • Indicates the handler expects a ‘code’ query parameter (typical in OAuth redirects) but it’s missing.

Artifacts:

  • Attached screenshot highlighting the error.

Status:

  • No resolution yet; user requests advice on fixing the OAuth flow and authentication/session setup.

Open questions:

  • How to properly receive/handle the OAuth redirect with the ‘code’ parameter.
  • Clarification of the sequence between JWT verification and exchanging the ‘code’ for a session/access token.
Summarized with AI on December 17. AI used: gpt-5.

"I’m new to the Shopify API and found the Python REST library outdated. I’m using FastAPI to make requests to Shopify for order data to build an inventory tracking system. My goal is to verify the initial JWT token, send a GET request to Shopify, and authenticate to create a session token. However, I get the following error:

{“detail”: [{“type”: “missing”, “loc”: [“query”, “code”], “msg”: “Field required”, “input”: null}]}

I use ngrok for HTTPS, so that’s not the issue. Any advice on fixing this?"