Skip to content

login

This command lets you login to the 01cloud eco-system, so you can perform the tasks. There are couple of options available to login using the zocli.

Single Sign On (SSO)

The most recommended way to login to the system is using this option. Using this you can make sure that your credentials cannot or won't be hijacked and you can login to the system using ease.

In order to login to the system using SSO follow the below steps,

Getting Started
Start with either of below,

zocli auth login [-s || --sso]

Or you can even use

zocli auth login

and choose the SSO : Login with browser using 01Cloud SSO (Single Sign On) Token option (which is printed on the console) to proceed on.
NOTE: To move along the options you can use your UP / DOWN keys on keyboard to proceed on, and even can filter the options typing typing characters.

CLI generated Token
After choosing the option, the zocli communicates with the server and gets a new SSO token from the server as response, which can be used within 5 minutes to login.
The zocli might have now printed the SSO token on the console like below,

Login in using the browser using a dynamically generated code.
! First copy your one-time code: 111111
Press Enter to open https://console.01cloud.io/login/sso in your browser...

Login through browser

Now either click on the link to open your default browser, or copy the link and paste to any browser, or press ENTER so the cli can open your default browser for you.

Then after you login to your 01cloud account (If not already logged in), you will be sent the link which was printed on the terminal.

Now, you can enter the CODE (printed on the console) on the text box and Press on Continue, and that will now log you to the zocli. You might should wait for couple of seconds, so that the zocli fetches all your token credentails to log you in. The maximum time for fetching the status will be at around 5 seconds, as the CLI continuosly fetches the status of the code in every 5 seconds.

You can verify the login using the zocli auth status command.

Access Token

To login using Access Token, follow the below steps,
(Feel Free to skip below step, if you already have Token generated from the profile section of UI)

Generate Access Token

Access Token can be generated from the profile section from the web portal or the console of 01cloud. To generate go to PROFILE > ACCESS TOKEN.

Click on New Token, and you will be prompted for the Notes and the expiration time of the token. Fill in them as desired.

After clicking Generate, the web UI will provide you the newly created token, BE SURE TO COPY TOKEN AS IT WILL BE VISIBLE ONLY FOR ONCE.

Input Token in CLI

Now execute the zocli login sub-command with -t flag on, i.e.

zocli auth login [-t || --token]

or use

zocli auth login

and choose Token : Login using pre-created token option to continue. Now the zocli prompts you for the token, there paste the token which we created on previous step. Now, zocli will communicate with the server and log you in by validating the token. If everything goes well, you can see a message printed on the console as,

✓ Logged in successfully as yourmail@mail.com

Export to environment
You can also export a variable containing the token as value to login to the system. Like,

export CLI_WEBTOKEN=token

will export your token to the os env for current session of your shell and then you can directly login using zocli using

zocli auth login [-t || --token]

Basic Creds

This option allows you to login using your basic username and password. To get started, you can use

zocli auth login [-b || --basic]

and then zocli will prompt you for inputing your username and password to the standard console.

Now, as soon as the zocli validates the credentails by requesting to the server, you get logged in, and you can see below statement printed on the console.

✓ Logged in successfully as yourmail@mail.com

NOTE: This way to login is not recommended and will possibly removed on future releases.

You can export he CLI_EMAIL and CLI_PASSWORD on the running shell and then use,

zocli auth login [- || --basic]

to login to the eco-system automatically. As the CLI checks for couple of variales onn the environment while booting system. You can check them on here

Wrap up

  1. zocli auth login -b or --basic, to use email and password to authenticate
  2. zocli auth login -s or --sso, to use Single SignOn method i.e. to use browser to login
  3. zocli auth login -t or --token, to use access token for logging into your account
  4. zocli auth login, to get all the options

You can always find the help menu using,

zocli auth login --help