Ensure that the x-shopify-request-jwt header is being validated correctly in your app proxy route. This JWT is signed using your app’s secret key and contains claims that verify the authenticity of the request.
Use a library like jsonwebtoken to decode and validate the JWT. Check for:
Valid signature using your app’s secret key.
Expiry (exp claim) to ensure the token hasn’t expired.
Matching method, url_sha256, and headers_sha256 claims with the incoming request.
2. Check Access Token and Scopes
Ensure that the access token used in the admin.graphql call has the required scopes for the query you are making. For example, to query products, you need the read_products scope.
If you are using online access tokens, remember that they are tied to a user’s session and expire after 24 hours or when the user logs out. Ensure you are refreshing or re-authenticating as needed.
Yes! Deleting the session from my Prisma DB and revisiting the admin page resolves the issue. I’ll investigate further to see if the token is refreshing but the session isn’t updating in the database. For now, deleting the session is a workaround.