5 Authentication

This section describes the Oracle Compute Cloud Service CLI commands that you can use to create and refresh an authentication token.

Only authenticated users can run the Oracle Compute Cloud Service CLI commands.

Before running the CLI commands described in this section, make sure that you've installed the CLI client and set up the required environment variables as described in Preparing to Use the Oracle Compute Cloud Service CLI.

Commands

auth

Sets the OPC_COOKIE environment variable. This request returns an authentication token in a cookie. The token expires after 30 minutes. As the CLI tool handles authentication by managing the cookies file, you don’t need to run this command. Run this command only to explicitly set the OPC_COOKIE environment variable, such as when you want to avoid contention between a short-lived script and cookies file and creating alternative cookies files is undesirable.

Syntax

oracle-compute auth username password

Parameters and Options

For general options, see CLI Command Options.

The following parameters and options are specific to this command.

Parameter Required / Optional Description

username

required

Two-part name of the user in the format, /Compute-identity_domain/user (example: /Compute-acme/jack.jones@example.com)

password

required

The password for the user. Full path and name of the file containing the password for the Oracle Compute Cloud Service user. The password file must be readable only by the owner of the file.

Note:

The account creation email from Oracle would contain the identity domain name, user name, and password, as shown in the following example:


User credentials are provided in the account creation email that you receive from Oracle.

For example, if your identity domain is acme and the username in your account-creation email is jack.jones@example.com, then the following would be the two-part user name that you must use:

/Compute-acme/jack.jones@example.com

Example

oracle-compute auth /Compute-acme/jack.jones@example.com -
Password:

Sample Output

Some lines have been truncated with ellipses (...) for readability. When you run the command in your environment, you'll see the full output.

export OPC_COOKIE='eyJpZGVu....ZYb2ZvSTRHWDVUdz09XCJ9In0='

refresh_token

Extends the expiry of the authentication token by 30 minutes from the time you run the command. Authentication tokens expire in 30 minutes. This command extends the expiry of the current authentication token, but not beyond the session expiry time, which is 3 hours.

Syntax

oracle-compute refresh_token

Parameter and Options

For general command options, see CLI Command Options.

Example

oracle-compute refresh_token