login
Authenticate with an environment and save credentials within the LMCTL configuration file for later use.
Usage command
Use the following command to authenticate with an environment:
lmctl login [OPTIONS] ADDRESS
Arguments
Name | Description | Default | Example |
---|---|---|---|
Address | Ishtar API gateway address of the target environment | - | https://cp4na-o-ishtar.example.com |
Options
Name | Description | Default | Example |
---|---|---|---|
-u , --username |
Username used to authenticate. | - | --username almadmin |
-p , --pwd , --password |
Password that is used to authenticate the user given on username . |
- | --pwd secret |
--api-key |
Specify the API key for the user if they are using Zen for authentication. | - | --api-key 123 |
--client |
Client ID that is used to authenticate. | - | --client Admin |
--client-secret |
Secret that is used for authenticating client . |
- | --client-secret secret |
--token |
Use a token instead of credentials for authentication. | - | --token eyJhbGciOiJIUzI1NiIsInR5cCI6.....8enat7Ao |
--zen |
Use Zen for authentication. If you specify this option, you must also specify the
--api-key option. |
False | --zen |
--name |
Name given to the environment saved in the configuration file. | Default | --name dev |
--auth-address |
The authentication address to use without client credentials for username or password access. The authentication address is your Nimrod UI route. If the user is using Zen for authentication, the authentication address is the address for the Zen authorization API. |
- | --auth-address https://cp4na-o-nimrod.example.com |
--save-creds |
Save the credentials instead of the token. | False | --save-creds |
--print |
Print the access token rather than saving it. | False | --print |
-y |
Force command to accept all confirmation prompts. For example, to override existing environment with the same name. | False | -y |
Examples
- Login with UI username and password
-
lmctl login https://cp4na-o-ishtar.example.com --auth-address https://cp4na-o-nimrod.example.com \ --username almadmin --password password
- Login with Rest API username and password
-
lmctl login https://cp4na-o-ishtar.example.com --client Client --client-secret secret --username almadmin --password password
Note: If you runlmctl login https://cp4na-o-ishtar.example.com
, then you need to enter the values suited for this combination. - Login with Rest API client credentials
-
lmctl login https://cp4na-o-ishtar.example.com --client Admin --client-secret secret
- Login with existing token
-
lmctl login https://cp4na-o-ishtar.example.com --token eyJhbGciOi...4s8enat7Ao
- Login with Zen username or
api-key
-
lmctl login https://cp4na-o-ishtar.example.com --zen \ --auth-address https://cpd-lifecycle-manager.apps.example.com/icp4d-api/v1/authorize --username almadmin --api-key 123
- Save with alternative name
- Names the environment
my-test-env
with alternative name, instead of thedefault
value.lmctl login https://cp4na-o-ishtar.example.com --client Admin --client-secret secret --name my-test-env
- Update environment
- You can call
login
on an existing environment to refresh the token or to replace credentials. In that case, you are prompted to override the existing environment.# First login lmctl login https://cp4na-o-ishtar.example.com --client Admin --client-secret secret # Second login lmctl login https://cp4na-o-ishtar.example.com --client Admin --client-secret alt-secret Login success An environment with name "default" already exists, do you want to override it? [y/N]: y Updating config at: /home/dvs/.lmctl/config.yaml
- Prompt for password
-
lmctl login https://cp4na-o-ishtar.example.com --auth-address https://cp4na-o-nimrod.example.com --username almadmin Password []: Login success Updating config at: /home/myuser/.lmctl/config.yaml
- Prompt for client secret
-
lmctl login https://cp4na-o-ishtar.example.com --client Admin Client Secret []: Login success Updating config at: /home/myuser/.lmctl/config.yaml