I solved the problem by myself.
Follow the tutorials: Build a Shopify App with Node.js and React
After I run "npm run dev", Then use the merchant install link. It finally works.
This actually worked for me too, except for this part
"Stop your server from the terminal window that’s running Next.js (ctrl + c).".
Don't stop your ngrok, and if you do, change the "App URL" and "Whitelisted redirect URLs" in the app settings.
After days of investigation and tests I found a workaround for this problem.
1. Navigate to the 'Custom App Merchant Link' in a chrome session (autenticate in the shopify store if necessary) Ignore the result...
2. Now, in the same chrome session navigate to the autentication url. Accept the installation:
Hope this helps someone.
This is a "local development environment" solution, not a production solution. The tutorial is great for local dev, but it does not say how this process translates into production. The install link works great for dev, but fails in production.
This message was in response to others saying: Follow the tutorials: Build a Shopify App with Node.js and React
That only works for development, not production.