I am trying to call the smart contract method (deployed on remote ethereum account) from my nodejs DAPP, and getting the following error-

Error: authentication needed: password or unlock
    at Object.InvalidResponse (D:\dapp\node_modules\web3\lib\web3\errors.js:38:16)

My web3 DAPP code looks like this-

var ABI = [abiinterface];
var contract = web3.eth.contract(ABI);
var contractInstance = contract.at(accAddress);

I have run the unlock code on my geth console using- personal.unlockAccount("address") which returned true, but still getting the 'authentication needed: password or unlock' error in the dapp. Any help or pointers are much appreciated. Thanks.


3 Answers 3


First, make sure you have an account.


If you get [] ...


Try again.

Then ...

web3.personal.unlockAccount(web3.personal.listAccounts[0],"<password>", 15000)

meaning unlock the first account with this password for 15,000 seconds (don't bug me for a while.)

The DAPP side should stop complaining about the lock.

Hope it helps.

  • 2
    The new account already exists, and I managed to unlock it using the geth console. Still getting the error on DAPP side.
    – rsingh
    Commented Jun 30, 2017 at 8:17
  • use MetaMask and select the unlocked account?
    – David
    Commented Jan 13, 2018 at 17:43

I was facing similar issue earlier. Make sure the following 3 things are taken care of:

  1. The account you are using is the first one from the list of accounts.(Or, if you are using some other account, make sure you have made the corresponding change in the nodejs code.)
  2. Make sure you unlock this same account using web3.personal.unlockAccount(web3.personal.listAccounts[0],"MyPassword", 15000) In my case, it was the first account itself.
  3. The account contains some ether.

This error is all about unlocking the account on your ethereum node. The difficulty is to spot the hidden cause. Some mistakes in web3js would cause the same issue :

For instance

web3.eth.personal.unlockAccount(_senderAddress, password, 0).then(

would issue this problem as it won't wait for the unlocking. So use a callback or await.

web3.eth.personal.unlockAccount(_senderAddress, password, 0).then(
                    isunlocked => {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.