Authorize developer org using web login
using the following command to open the default Salesforce login page (https://login.salesforce.com) and you can enter username and password to authorize dev org.
sf org login web -a devorg
// Set the authenticated org as the default org
sf org login web -a devorg -s
Authenticate Sandbox with web flow
Run the following command to Log in to a sandbox and set it as default org.
sf org login web -r https://MyDomainName--SandboxName.sandbox.my.salesforce.com -s
Authenticate Devhub org with web login
This sf command will open browser and Log in to your Dev Hub, set it as your default Dev Hub, and set an alias as devhub.
sf org login web -d -a dev-hub
Flags:
- -a: Alias for the org
- -s: Set the authenticated org as the default.
- -r: instance url
- -d: Set the authenticated org as the default Dev Hub.
Source:
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_org_commands_unified.htm#cli_reference_org_login_web_unified