I requested active account address from Metamask and received it successfully. After that I tried to authenticate user by signing data with eth.personal.sign, but getting errors unfortunately.
signMessage( publicAddress: string, nonce: number ): Promise<any> {
return this.web3.eth.personal.sign(
this.web3.utils.fromUtf8( `Sign: ${nonce}` ), publicAddress ).then( ( signature ) => {
return signature;
} )
}
Getting this error: Invalid Arguments length: expected: 3, given: 2 (guess need password as 3rd argument?)
When using eth.sign( hash, addr) it gives: Uncaught TypeError: t is not a function (inpage.js)
I was following this tutorial: https://www.toptal.com/ethereum/one-click-login-flows-a-metamask-tutorial, and here he doesn't need the account password to sign data.
Also, if I do this from the browser in my app it works, I get back the signature:
web3.eth.personal.sign('data','0x7567d83b7b8d80addcb281a71d54fc7b3364ffed',(err,sig) => console.log(sig) )
So what can be the difference? web3 from Metamask seems to be beta_37 while in my app beta_46, but now I am a bit lost.
Thanks