Initial Access Token Requests
Request an access token by using HTTPS to post your request. If you do not have Mutual TLS (mTLS) authentication enabled, include the OAuth Client ID and Client Secret as HTTP Basic Authorization credentials. If you have mTLS enabled, include the OAuth Client ID in the request.
Initial access token request Without mTLS
curl -X POST
{{oauth_server_url_prefix}}/v2/oauth/token \
-H 'Authorization: Basic Base64_Encoded_Client_And_Secret' \
-H 'Content-Type:application/x-www-form-urlencoded' \
-d 'grant_type=client_credentials'
Where:
oauth_server_url_prefix is the URL prefix for the OAuth server for your region, as shown on the SAP Ariba Developer Portal on the discovery page for any API, in the Environment details table.
Base64_Encoded_Client_And_Secret is the Base64-encoded OAuth Client ID and OAuth Secret generated as described in Generating the OAuth Secret and Base64 Encoded Client ID and Secret.
Initial access token request with mTLS
Use the following CURL example as a model when constructing the initial HTTPS mTLS request your application sends to the OAuth server for the initial access token. The request specifies the OAuth Client ID. The request also includes the X.509 certificate file for the client and the corresponding private key file:
curl --request POST 'oauth_server_url_prefix/v2/oauth/token?grant_type=openapi_2lo'\
--header 'client-id: clientId' \
--cert "myCertFile" --key "myPrivateKeyFile"
Where:
oauth_server_url_prefix is the URL prefix for the OAuth server for your region, as shown on the SAP Ariba Developer Portal on the discovery page for any API, in the Environment details table.
clientId is the OAuth Client ID for the application. You can obtain the ID as described in Finding Your Application's Application Key and OAuth Client ID.
myCertFile is the name of the X.509 certificate file configured to authenticate your client as described in Managing Security Certificates for Mutual Authentication.
myPrivateKeyFile is the name of the private key file that corresponds to the X.509 certificate.
Sample Response
{
"timeUpdated": 1462815524141,
"access_token":"5b685b82-7f5a-42eb-b4a3-027004d317f5",
"refresh_token":"6d6b2b9d-8264-46fd-9909-c870215d9b21",
"token_type": "bearer",
"expires_in": 1440
}
Response Parameters
- timeUpdated
- the time when the access token was created
- access_token
- the token to be included in each request for access to protected resources
- refresh_token
- the token to be included in a request for a new access token when your current access token has expired
- token_type
- always bearer
- expires_in
- the duration in seconds before the token expires. The default is 1440 secondes, or 24 minutes