Authentication and Login
The CLI Application supports logging into the system with your username and password (and two-factor authentication, if enabled) or by providing your API key.
Password Authentication
The CLI App will prompt you for your site name, username and password when you use it. These will be remembered until you logout or your session expires.
To pre-configure the CLI App with a specific username and password, you can provide the CLI App with information about your Files.com account:
files-cli config set --subdomain="MYSITENAME" --username="MYUSERNAME"
When prompted, enter your password.
If your site has a Custom Domain configured and you want to connect to it rather than the files.com subdomain, specify the fully qualified domain name (FQDN) with the --endpoint flag:
files-cli config set --endpoint="https://files.mycompany.com" --username="MYUSERNAME"
Once you've specified your subdomain or endpoint information and username, you do not need to specify it again for subsequent uses of the CLI App.
For later uses, you can login using the following command, which will prompt you for your password:
files-cli login
If your account requires Two-Factor Authentication, you will be prompted for the second factor after you submit your password. Once you are logged in, subsequent uses of the CLI App will perform those actions using your credentials and permissions until you log out.
API Key Authentication
When using an API Key with the CLI App, supply the API Key on the command line with the --api-key option:
files-cli --api-key="YOUR_API_KEY" folders list-for
Using an API Key to authenticate will not trigger a Two-Factor Authentication challenge, even if you normally require one to log into the web interface.
Logging Out
Your login session expires automatically after 6 hours, or sooner if your authentication system's settings dictate a shorter timeout.
To manually log out of your session, use:
files-cli logout