Generate and Use Access Tokens in REST API and CLI Payloads (Identity Domains)
If you want to create an Oracle Analytics Cloud instance programmatically, you must generate an access token that you can include in the payload for REST API or CLI create operations. Access tokens are set to expire after a certain time period so you might need to repeat this task for subsequent create operations. By default, access tokens are valid for one hour (3600 seconds).
These instructions are for tenancies that use identity domains. If your tenancy uses Oracle Identity Cloud Service (IDCS), see Generate and Use Access Tokens in REST API and CLI Payloads (IDCS).
You can generate access tokens using the Console or programmatically (using CLI or an API).
To generate access tokens from the Console:
- Generate the access token using an API or
from the CLI. For
example:
curl -X POST -u "<client_id>:<client_secret>" -H 'content-type: application/x-www-form-urlencoded;charset=UTF-8' -d "grant_type=password" -d "username=<user>" -d "password=<password>" -d 'scope=urn:opc:idm:t.user.me' "https://<stripe>.identity.oraclecloud.com:443/oauth2/v1/token"
Note
Navigate to your domain's information page to obtain thestripe
associated with your domain. Click Show next to the Domain URL property to discover thestripe
value.The command returns a JSON response similar to this:
{"access_token":"eyJ4NXQjUzI...0jxcCw5oR0ajaNw","token_type":"Bearer","expires_in":3600}
- Copy the access token from the JSON. For example,eyJ4NXQjUzI...0jxcCw5oR0ajaNw.
- To create an Oracle
Analytics Cloud instance with this access token, do one of the
following:
- REST API CreateAnalyticsInstance: Specify the token
value in the parameter
idcsAccessToken
. - CLI analytics-instance create: Copy the token
value to a file and specify the name of the file
in the CLI parameter
--idcs-access-token-file [filename]
.
- REST API CreateAnalyticsInstance: Specify the token
value in the parameter