Authentication issues with using sandbox api keys on development site

i have a development site on vercel, i have the sandbox api all setup like how i have it on my local dev environment.

on my local machine everything works flawlessly, but when i try to test the staging test im getting:

Error fetching catalog items: {
  message: 'Response status code was not ok: 401.',
  response: undefined
}

So I deployed a production site with the live square api keys and live catalog ids, and it works fine.

Does the sandbox api keys not work on staging environments?

:waving_hand: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Get Developer Credentials
Move OAuth from the Sandbox to Production
Square Node.js SDK Quickstart

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

The Square Sandbox API keys should work in any environment, including staging, as long as they are correctly configured. The error message you’re seeing (401 status code) typically indicates an issue with authentication. This could mean that your Sandbox API keys are not correctly set up in your staging environment.

Please double-check that your Sandbox API keys are correctly configured in your staging environment. Also, ensure that the keys are not exposed or hardcoded, and they are securely stored in environment variables or some form of secure secret management.

Remember, the Sandbox API keys and production API keys are different. So, ensure you’re not mixing them up. If the problem persists, you might want to check the specific API request that’s failing to see if there’s an issue with how the request is being made.

This answer was reviewed by @Bryan-Square.