CORS error when trying to connect to Kmd from browser app

I’m getting a CORS error when I try to submit a POST request (createWallet) via the JavaScript SDK (browser). I’m connected to a TestNet node. Is this a known issue or am I doing something wrong?

i have experience with js sdk algod and indexer (mainnet,testnet,sandbox,privatenet), and there is no such issue

i think you should post some request or screenshot what you are doing if you want some help

Hi sholtz, thanks for your response. I’m trying to send POST request to the kmd service, which appears to be running, from my Next.JS app. I can successfully connect to the kmd service from the browser but I get the following error when I call kmd.createWallet(name, password):

Access to XMLHttpRequest at 'http://localhost:7833/v1/wallet' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Take a look at the allowed_origins setting in the kmd_config.json file in your kmd data directory: Node Configuration Settings - Algorand Developer Portal

Note that this is for creating accounts in KMD. You do not have to use KMD if you want to do key management yourself. The SDK provides methods for creating accounts.

1 Like

by my experience it is usually caused by the other error that throws for example 500 error… thus the OPTION request does not work properly and browser thinks it is the cors error…

if you have private kmd/algod/indexer there is setting to set up the cors so that the requests can be handled only from your website

by my experience the public servers usually does not have cors setup