Authorization Commands
The ml auth
command group provides facilities for authorization.
The following commands can be used together with ml auth
:
init
Authenticates the CLI.
When you run the command, a browser opens for you to log in. After a successful login, you will see a message confirming success. For example, "User authenticated. Close this tab and go back to the console."
Flags
The following flags are available with the ml auth init
command:
-
--webserver/--disable-webserver
Enables or disables a Web server. A Web server runs by default.
When running
ml auth init
on machines without browsers, it is recommended to use the--disable-webserver
flag. Instead of opening a browser, you will be given a URL and be prompted to enter a token. Using the URL on a different machine with a browser will provide the token that you need to enter.
resource
Creates a service token for a specific resource.
The following flags are available with the ml auth resource
command:
-
--org TEXT
Organization to use.
whoami
Displays the Id, email address, and user name of the current user.
Example
In this example, the ml auth whoami
command is used with the global -o option to print the output as a JSON structure:
ml -o json auth whoami
The output looks something like this:
{"user_id": "bd748656-6815-4ae5-bcf4-3b09c911f43f", "name": "Joe Smith", "email": "[email protected]"}