vlocode-project - v1.40.0-beta-4
    Preparing search index...

    Function deviceLogin

    • Login to Salesforce using the OAuth2 Device Flow. In this flow a user code is displayed to the user that must be entered on the device login page.

      If o options are specified the default login URL is used defaultLoginUrl.

      Parameters

      Returns Promise<DeviceLoginFlow>

      The authentication result

      const loginFlow = await sfdx.deviceLogin();
      console.log(`Please login to Salesforce using the code ${loginFlow.userCode} on ${loginFlow.verificationUrl}`);
      // Ser the openVerificationUrl option to false to prevent opening the verification URL in the browser
      const authResult = await loginFlow.awaitDeviceApproval({ openVerificationUrl: true });
      console.log(`Successfully logged in to Salesforce as ${authResult.username}`);