Entitle for CLI
What is a CLI?
A Command Line Interface (CLI) is a text-based interface used to interact with software and systems by typing commands. It’s commonly used by developers, DevOps engineers, and IT professionals to automate tasks, manage infrastructure, and integrate tools into scripts or pipelines without relying on graphical user interfaces.
How is Entitle for CLI useful?
Entitle for CLI makes it easy and secure to access Entitle’s API directly from the command line. Instead of requiring manual logins or static tokens, Entitle initiates a one-time browser authentication session that links your identity to a temporary CLI token that remains valid for up to 12 hours. This setup is ideal for users who want to automate permission requests, run access audits, or integrate Entitle into scripts.
For further details on Entitle's API, see the Entitle API reference.
Prerequisites
- Have a free TCP port on your local machine (between
10000
and65535
). - Optionally, verify that SSL is supported by your CLI.
Start a local server on a valid port
Ensure a local server is listening on a valid port (e.g., 10000
).
Open the login URL
-
In your browser, paste the following URL, replacing {
PORT
} with your actual port number (e.g.,12345
):https://app.entitle.io/cliLogin?port={PORT}
- If your CLI supports SSL, add the
&secured=true
parameter to the URL. For example:https://app.entitle.io/cliLogin?port={PORT}&secured=true
- If your CLI supports SSL, add the
-
Press Enter to open the link.
Log in to Entitle
-
A new browser tab will open displaying Entitle’s login screen. Log in using your organization’s identity provider — Google, Microsoft, or Okta.
Note
When a CLI session is triggered, the user runs the configured CLI command. This command opens a new browser tab directing the user to the Entitle login page.
-
After logging in, you’ll be redirected to the following URL, which includes your authentication token. A Done message will appear in the browser to confirm that the process completed successfully.
http{s}://localhost:{PORT}?token={TOKEN}
Note
The {
PORT
} and {TOKEN
} values shown in the URL are specific to your session and environment. -
The CLI automatically captures this token from the redirect and outputs it. This user is then able to use Entitle's API within that CLI session, authenticating subsequent API requests using the token.
Error handling
If the launch was not successful, this could be due to a couple of reasons:
Error message/condition | Meaning |
---|---|
"CLI server not configured for the requested port. Please ensure the server is running and properly set for port {port}" message | The specified port is not open or accessible |
"Invalid port" message | The port number is invalid — it must be between 10000 and 65535 |
The session fails to authenticate | The user closed the browser window or canceled the authentication process |
CLI session flow
1. User runs CLI command
2. CLI opens browser window → Entitle Login
3. User authenticates
4. Token is returned via redirect to localhost
5. CLI captures token and can now use the Entitle API
Example
# Run a local listener (e.g., using Python for testing)
python3 -m http.server 12345
# In browser, open:
https://app.entitle.io/cliLogin?port=12345
Output (captured via redirect):
http://localhost:12345?token=abc123def456
Updated about 14 hours ago