Authenticate

Oracle Machine Learning REST APIs, such as the REST API for Embedded Python Execution, use tokens to authenticate an Oracle Machine Learning user.

You access the Oracle Machine Learning for Python REST API Embedded Python Execution functions over HTTP and must provide the following information for authentication:
  • User name and password for your Oracle Machine Learning Cloud Service account.

To authenticate and obtain a token, use cURL with the -d option to pass the user name and password for your Oracle Machine Learning 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 an 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 omlserver URL from the Development tab in the Service Console of your Oracle Autonomous Database instance.

    Note:

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