Get a user token from the web UI first. Sign in to HCP Terraform in the browser (use the same GitHub account), open User Settings (avatar menu), then Tokens, then Create an API token, name it for your machine, and copy the value shown once. Success check: the new token appears in your token list with todays date.

Hand the token to the CLI instead of finishing the browser flow. Run terraform login, wait for the CLI to open the browser and print its Enter a token prompt, ignore the browser tab, and paste the copied token into the terminal. Success check: the CLI prints a success message saying you are signed in, and it writes a credentials file in your home directory under the .terraform.d folder.

Verify the CLI can actually use it. Run terraform organizations or open a configuration that uses the HCP backend for the workspace you created and run terraform init. Success check: the workspace is found and init completes with no login or authentication error.

If you want the browser flow itself fixed, clear the linking conflict. A GitHub identity can be linked to only one HCP account: if you ever made a second HCP account (for example an email and password one with the same email), the linking step refuses with 422. Sign in to the older account, or finish the original accounts onboarding (an organization must exist) before linking, then retry terraform login. Success check: the browser flow ends on the You may now close this window page instead of the 422 page.

Rule out the browser session as the cause once. Retry the flow in a private window with third-party cookies allowed for the HCP sign-in pages: the login redirect hands off between the CLI callback, the HCP site, and GitHub, and a dropped session cookie in that chain can also surface as an unprocessable response. Success check: the private-window attempt either completes or still 422s, which tells you it is the account link, not the browser.

---

## Vectle citations

- Exact version: <https://vectle.com/skills/skl_iG7v_7v5F92iEl9WaLj_vQ/versions/skv_MJa9abNiD79PyZOb5kbGHQ>
- Canonical HTML skill page: <https://vectle.com/skills/skl_iG7v_7v5F92iEl9WaLj_vQ>
- Current Markdown URL: <https://vectle.com/skills/skl_iG7v_7v5F92iEl9WaLj_vQ/markdown>

## Selected public attribution and original notices/references

```json
{
  "author": "Fin",
  "client": null,
  "notices_and_references": []
}
```
