How Does Primavera Cloud Support Basic Authentication?
To access the Oracle Primavera Cloud REST API hosted on Oracle Cloud Infrastructure (OCI), you need to generate a Basic access token using Basic Authentication. This token will then be used to authenticate your API requests. Oracle Primavera Cloud uses OAuth-based Bearer authentication scheme.
Generate OAuth Token Using Basic Authentication
Use the
primediscovery
endpoint to generate an OAuth access token. This endpoint requires Basic Authentication with a valid user and password. The scope should be the full path (always http) to the application's context root-
http://<SERVER_URL>/api
.
To Generate the OAuth Token:
Step 1: Encode Credentials in Base64
You need to generate a Base64 encoded version of your user name (email) and password.
To generate an encoded version of your Oracle Primavera Cloud user name and password:
- Go to https://www.base64encode.org/.
- Enter the user name and password in the following format:
username:password
- Click Encode.
- Copy the encoded user name and password.
- Replace
<Base64-encoded-username-and-password>
in the examples below with the encoded user name (email) and password.
Step 2: Request for the OAuth Token Using Curl or a REST Client
Use the encoded credentials to request the OAuth token using CURL or a REST Client (such as Postman). Replace
<SERVER_URL>
with the URL of the server to which your application is deployed and
<Base64-encoded-username-and-password>
with the Base64 encoded user name (email) and password you generated in step 1.
-
Using CURL:
curl -X POST "https://<SERVER_URL>/primediscovery/apitoken/request?scope=http://<SERVER_URL>/api" \ -H "Authorization: Basic <Base64-encoded-username-and-password>"
-
Using a REST Client:
POST https://<SERVER_URL>/primediscovery/apitoken/request?scope=http://<SERVER_URL>/api
Enter the following information in Headers:
Authorization: Basic <Base64-encoded-username-and-password>
Step 3: Interpret the Response
The response will contain the OAuth access token and additional details.
Response Payload
{ "accessToken": "<OAuth-Access-Token>", //deprecated "access_token": "<OAuth-Access-Token>", "token_type": "Bearer", "primeTenant": "<tenant>", "primeTenantCode": "<tenant-code>", "userName": "<identity_domain_user_email>", //deprecated "username": "<identity_domain_user_email>" "userId": "<identity_domain_user_guid>", "primeIdentityApp": "<prime_app_identity_id>", "expiresIn": 3600 //deprecated "expires_in": 3600 "requestHeaders": { "<x-param1>": "<param1-value>", "<x-param2>": "<param2-value>", ... ... ... "<x-paramN>": "<paramN-value>" }
Note The following fields have been deprecated: accessToken, UserName, expiresIn. Use the following fields instead: access_token, username, expires_in.
Use the OAuth Token to Access the API
After obtaining the OAuth token, use it to authenticate your requests to the Primavera Cloud REST API. Include the token and any required headers in your requests. Copy the requestHeaders from the response in your code. See Use OAuth Token for HTTPS Authentication for more information.