Call /account/generate error

for create account(test net) :
curl -X GET http://23.228.67.85:7890/account/generate

this comend return
{“timeStamp”:83669969,“error”:“Unauthorized”,“message”:“remote 119.57.162.66 attempted to call local /account/generate”,“status”:401}

how to solve this.
thx

1 Like

Keep in mind that the private key would be shared with anyone over the network in this way. This is a really bad way to do it. If you feel you still need to do it you can adjust the config file so it doesn’t force localhost I believe.

What is the correct way to create account via a program?thx

You have a few options. If you know that the call will always be localhost then using the generate api isn’t so bad. If you are just trying to create some keypairs, using the https://github.com/QuantumMechanics/NEM-sdk#61---create-private-keys , or https://nemlibrary.com/ would be a good way to go. If you search github you will find some examples.

Also check out: https://rb2nem.github.io/nem-dev-guide/03b-accounts/
Most of the examples are in java, but you will get the gist and convert to whatever language you are using. Node.js has the least learning curve, but starting with java will give you a good foundation.

2 Likes

thx

1 Like