near / near-cli

General purpose command line tools for interacting with NEAR Protocol
https://docs.near.org
MIT License
193 stars 93 forks source link

Failed to verify accountId. [-32700] Parse error: Failed parsing args: missing field `account_id` #946

Open faisal00813 opened 2 years ago

faisal00813 commented 2 years ago

Describe the bug Unable to login. Near-cli is failing with error: Failed to verify accountId. [-32700] Parse error: Failed parsing args: missing field account_id

To Reproduce Steps to reproduce the behaviour:

  1. Create an account in near-wallet
  2. Install near-cli version 3.2.0 on OSX
  3. try near login

Expected behavior Should wait for the browser to authenticate

Screenshots

Desktop (please complete the following information):

faisal00813 commented 2 years ago

Seems to be related to this

pablofelipe01 commented 2 years ago

@faisal00813 did you fix it?

faisal00813 commented 2 years ago

No. Still facing the same issue on Mac.

adamk72 commented 2 years ago

I'm experiencing the same issue. Is there a way/need to generate the keys for .near-credentials/testnet/*.json such that it matches the public_key param that is being passed up to the browser?

I notice that I don't have any public/private key paring on my local machine that matches the public_key param passed with the URL, e.g. https://wallet.testnet.near.org/login/?referrer=NEAR+CLI&public_key=ksjdflaksjdf&success_url=http%3A%2F%2F127.0.0.1%3A5001.

edit: Also it seems weird to have the success results point to a localhost server when nothing is running on that port.

adamk72 commented 2 years ago

According to this site: https://www.near-sdk.io/zero-to-hero/basics/set-up-skeleton,

When you typed near login, NEAR CLI generated a key pair: a private and public key. It kept the private key tucked away in a JSON file and sent the public key as a URL parameter to NEAR Wallet. The URL is long and contains other info instructing NEAR Wallet to "add a full access key" to the account. Our browser's local storage had a key (created when the account was made) that is able to do several things, including adding another key. It took the public key from the URL parameter, used it as an argument, and voilà: the testnet account has an additional key!

This apparently isn't happening, because no files are being added to .near-credentials. Yet somehow, it's generating a public key to add to the URL.

adamk72 commented 2 years ago

I looked into the near-cli source code and found that there was a callback using port 5000. My Mac (Monterey 12.3.1) was using port 5000 already, which I couldn't kill off and which in turn led me to a quick Google search. All the articles basically say this: Screen Shot 2022-05-23 at 13 33 36 Did so, and now I'm able to use near login successfully.