Skip to content
Development
Command

/login

Authenticate to a new Salesforce org via the browser (sf org login web). Optionally set the org as the project's default target.

From plugin
sf-skills
1.1k15 skills6 agents15 commands4 MCP
$ npx -y skills add forcedotcom/sf-skills --agent claude-code

Command definition

login.md
description: Authenticate to a new Salesforce org via the browser (sf org login web). Optionally set the org as the project's default target.
allowed-tools:
  - Bash
argument-hint: "[--alias <name>] [--instance-url <url>] [--set-default]"

Authenticate to a Salesforce org. The user can pass:

  • `--alias <name>` to label the auth (e.g., `myDevHub`, `customerSandbox`)
  • `--instance-url <url>` for non-production endpoints (e.g., `https://test.salesforce.com` for sandboxes, `https://login.salesforce.com` for production — production is the default if omitted)
  • `--set-default` to set this org as the project's `target-org` after auth

Workflow:

1. **Parse the arguments** ($ARGUMENTS) the user provided. Extract alias, instance-url, and set-default flag.

2. **Run the login command:**

   sf org login web {--alias $ALIAS} {--instance-url $URL}

This opens a browser for OAuth. Tell the user clearly: "A browser window will open. Complete the login flow and return here."

3. **Handle browser-isn't-available case:** If the user is on a remote shell or the browser won't open, fall back to:

   sf org login device-code {--alias $ALIAS} {--instance-url $URL}

which prints a code the user enters at salesforce.com/setup/connect.

4. **After successful auth:** if the user passed `--set-default`, run:

   sf config set target-org $ALIAS

Otherwise, suggest they run `/salesforce-development:set-default <alias>` if they want to use this org for the current project.

5. **Verify:** print a one-liner with the new org's alias, edition, and instance URL:

   sf org display --target-org $ALIAS --json

so the user sees the connected state.

Rules:

  • Always use `--json` on `sf` commands so you can parse outcomes
  • Do NOT log access tokens or any auth secrets
  • If the user doesn't supply an alias, the auth saves under their username — recommend they pass `--alias` for easier reference later
  • For sandbox auth, `--instance-url https://test.salesforce.com` is required
Read more
@forcedotcom
Ships withsf-skills

This repository provides Salesforce agent skills, plugins, and sample apps for building applications.

1.1k200 skills6 agents4 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
1.1k
Star history of forcedotcom/sf-skills on GitHub, a chart by star-history.com

Other commands on sf-skills.

discover

discover

Command

Show ranked what's-next nudges across the six-stage journey, run on-demand org feature detection, or find an uninstalled plugin…

@forcedotcom@forcedotcomInstall Command
feedback

feedback

Command

Record a quick 1-5 satisfaction rating as local usage telemetry. Manual-only — never dispatched by the model.

@forcedotcom@forcedotcomInstall Command
logout

logout

Command

Sign out of one or all Salesforce orgs (sf org logout). Confirms before destructive action.

@forcedotcom@forcedotcomInstall Command
org

org

Command

Show just the connected Salesforce org details — alias, edition, API version, instance URL, username.

@forcedotcom@forcedotcomInstall Command

More commands from other plugins.

build
Auto-invoked

build

Command

Implement tasks incrementally — build, test, verify, commit. Add "auto" to run the whole plan in one approved pass.

@addyosmani@addyosmaniInstall Command