I'm trying to Authorize my salesforce org to VSCODE using session Id as mentioned in the documentation. But it is not working. Can you please let me know what mistake I'm doing here.

  1. sfdx force:config:set instanceUrl=https://na35.salesforce.com (from documentation)
  2. sfdx force:mdapi:deploy --deploydir **md-dir** --targetusername **access-token**

Documentation link : https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_existing_access_token.htm

I'm getting the following error : ERROR running force:mdapi:deploy:report: Must pass a username and/or OAuth options when creating an AuthInfo instance.

Below is the error


1 Answer 1


Please use, proper instance URL and it'll work fine.

if you use - />sfx force:org:display it will show the correct instance name( something like domain .my.salesforce.com ) along with current access token.

I tried the same, and it is working fine.

Screemsjpt - Depicting the sfdx:force:deploy with the help of access token

  • I didn't get your point. I'm trying to authroize the org for the first time to vscode. I'm creating a new project and trying to Authorize my salesforce org using Access token.
    – shaan
    Oct 9, 2020 at 3:00
  • I didn't understand, if you want to login, why you're using deploy command? Are you not supposed to use - force:auth:web:login or other ways of auth namespace.
    – Ysr Shk
    Oct 9, 2020 at 5:17
  • is there a way I can login using access toekn / session id , when using force:auth:web:login it will ask me username and pwd which i'm trying to avoid and try using session Id. is it possible?
    – shaan
    Oct 9, 2020 at 18:32
  • I'm not sure direct way however if you want to login without a password, you can use JWT. This uses a certification file and username+consume key to log in. The same is available on the trailhead to try.
    – Ysr Shk
    Oct 10, 2020 at 10:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .