Authenticate

Oracle Machine Learning Services REST APIs use tokens to authenticate an Oracle Machine Learning Services user.

You access the Oracle Machine Learning REST resources from Oracle Autonomous AI Database and must provide the following information for authentication:

  • User name and password for your Oracle Machine Learning user account.

To access Oracle Machine Learning Services using the REST API, you must provide an access token. To authenticate and obtain an access token, use cURL with the -d option to pass the user name and password for your Oracle Machine Learning Services account against the Oracle Machine Learning User Management Cloud Service REST endpoint /oauth2/v1/token.

Example of cURL command to send request to Oracle Machine Learning User Management Cloud Service REST endpoint /oauth2/v1/token:

$ curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' 
-d '{"grant_type":"password", "username":"'${username}'", "password":"'${password}'"}' 
"<oml-cloud-service-location-url>/omlusers/api/oauth2/v1/token"

The example uses the following values:

  • username is the user name of an Oracle Machine Learning user who has the OML DEVELOPER role.
  • password is the password for your username.
  • oml-cloud-service-location-url is a URL containing the REST server portion of the Oracle Machine Learning User Management Cloud Service instance URL that includes the tenancy ID, database name, and the location name. You can obtain the URL from the Related Services section under Database Actions in the Service Console of your Oracle Autonomous AI Database instance.

Note:

When a token expires, all calls to the OML Services REST endpoints with return a message stating that the token has expired along with the HTTP error: HTTP/1.1 401 Unauthorized