Why doesn't the token work?

Topic summary

A developer encountered a 401 Unauthorized error with the message “Invalid API key or access token (unrecognized login or wrong password)” when attempting to use a saved access token to retrieve store products via the Shopify Admin API.

Initial Setup:

  • Created a Remix app and dev store following official documentation
  • Saved the accessToken from the session during app installation
  • Attempted to use this token for subsequent API requests

Resolution:

  • Creating a new dev store and reinstalling the app resolved the issue
  • Root cause identified: When uninstalling and reinstalling the app on the same dev store, the access token was not being updated via Remix

Key Takeaway:
This appears to be a bug in the Remix implementation where token refresh doesn’t occur properly during app reinstallation on existing stores.

Summarized with AI on November 3. AI used: claude-sonnet-4-5-20250929.

I created the remix app and dev store according to the documentation.

I save the accesToken that I get when installing the application

export const loader = async ({ request }) => {
  const { admin, session } = await authenticate.admin(request);
  await saveAuth({
    shop: session.shop,
    accessToken: session.accessToken
  })

  return null;
};

Now I want to use this token to get store products. According to the documentation, I make a request:

I add the token according to the documentation

Can you please tell me why I’m getting an error?

401 Unauthorized

"“errors”: “[API] Invalid API key or access token (unrecognized login or wrong password)”

Created a new dev store and installed there. The problem disappeared. For some reason, when you uninstall the app and dev store and then install it again, the token is not updated via remix. It’s a terrible bug