I'm trying to develop an app using React and Node, following the tutorial from docs, exactly as it is in there. Right now, I'm on this step: Authenticate and test your app. When I try to execute the following URL (HTTPS://YOURNGROKADDRESS.io/auth?shop=YOURSHOPIFYSTORE.myshopify.com), replacing the ngrok address and my shopify store, I get 400 Oauth error invalid_request: Could not find Shopify API application with api_key, even if I configured the .env file correctly, with the ngrok running and npm run dev also executed.
You can see some screenshots attached with my code. I really don't know why it's not working, considering that I followed the tutorial step by step.
What do you think?
That's weird. I haven't gone through that tutorial so i cannot comment about its current state or possible errata, but looking through the code how you're initialising your koa server and doing the Shopify koa auth handshake, looks kosher to me. In fact, I am doing much the same and it works fine.
The only difference is you're using Next. Fair enough, shouldn't interfere at this point. Even so, if something doesn't work and I rushed ahead pulling in too many libraries and frameworks because I thought I'll need them or someone wrote I'll need them, I dump them. Literally, get rid of any clutter even dotenv - just hardcode the keys to make sure it's not in the setup. Backtrack from the simplest point you get running then keep adding to it.
If you're still stuck in 24 hours, let me know and I'll run through that tutorial quickly to see what's going on.
Just in case this helps someone else - I had the same exact problem and had also created a process.env file.
Besides renaming, to ".env", I also encountered:
1.- I had put quotes around the API keys in the file, removed those.
2.- In the URL, make sure the second parameter doesn't have "HTTPS://", it should be like this:
(replace the bold parts with your values)