hcp auth login
Command: hcp auth login
The hcp auth login
command lets you login to authenticate to HCP.
If no arguments are provided, authentication occurs for your user principal by initiating a web browser login flow.
To authenticate non-interactively, you may authenticate as a service principal.
To do so, use the --client-id
and --client-secret
flags. A service principal
may be created using hcp iam service-principals create
or via the HCP
Portal.
If authenticating a workload using a Workload Identity Provider, a credential
file may be used to authenticate by passing the Path to the credential file
using --cred-file
. The command should be running in the environment that
Workload Identity was previously configured to be able to retrieve and federate
external credentials from.
Usage
Examples
Login interactively using a browser:
Login using service principal credentials:
Login using Workload Identity credentials:
Flags
--client-id=ID
- Service principal Client ID used to authenticate as the given service principal.--client-secret=SECRET
- Service principal Client Secret used to authenticate as the given service principal.--cred-file=PATH
- Path to the credential file used for workload identity federation (generated byhcp iam workload-identity-providers create-cred-file
) or service account credential key file.