To obtain Oauth authentication using cURL:
- Get an auth code.
- Generate an access token.
- Test your access token.
Use the following model as a cURL request for an auth code:
https://ims-na1.adobelogin.com/ims/authorize?client_id={CLIENT ID}&redirect_uri={REDIRECT URI}&scope=openid,AdobeID,read_organizations,additional_info.job_function,additional_info.projectedProductContext&response_type=code
To get an auth code:
- Copy the Client ID from your OAuth client and paste it into the
{CLIENT ID}
placeholder in the URI above. - Replace
{REDIRECT URI}
with the redirect URI you specified when creating the client. - Paste the complete URI into your favorite browser.
- After authenticating via IMS, copy the auth code query parameter in the URI (the parameter begins with
code=eyJ4...
).
Use the following model to generate an access token:
curl --data "grant_type=authorization_code&client_id={CLIENT ID}&client_secret={CLIENT SECRET}&code={AUTH CODE QUERY PARAMETER}" https://ims-na1.adobelogin.com/ims/token/v1
To generate an access token:
- Replace
{AUTH CODE QUERY PARAMETER}
with the auth code you copied from the previous step in the above cURL request. - Replace
{CLIENT ID}
in the above request with the Client ID from your Oauth client. - Replace
{CLIENT SECRET}
in the above request with the Client Secret from your Oauth client. - Run the cURL command. The response includes an
access_token
attribute, as shown below:
{
"account_type": "type1",
"utcOffset": "null",
"preferred_languages": [
"en-us"
],
"projectedProductContext": [
{
"prodCtx": {
"serviceCode": "dma_analytics",
"global_company_id": "testco0",
"login_company": "Test Company",
...
}
},
...
],
"displayName": "James Ross",
"last_name": "Ross",
"token_type": "bearer",
"userId": "JAMESROSS@AdobeID",
"access_token": "eyJ4...TOKEN_OMITTED",
"refresh_token": "eyJ4...TOKEN_OMITTED",
"emailVerified": "true",
"phoneNumber": null,
"countryCode": "US",
"name": "Bob Ross",
"mrktPerm": "EMAIL:false",
"mrktPermEmail": "false",
"expires_in": 86399988,
"first_name": "James",
"email": "[email protected]",
...
}
Note: If you have access to numerous product profiles, the response can be very large. If it is so large that the access_token
is truncated from the response, you can write it to a file in order to find your access token. To write the response to a file, add >> output.json
to the end of your cURL request. The response is then written to a file named output.json
.
- Copy the access token to test it in the following section.
To test your access token:
curl -X GET --header "Accept: application/json" --header "x-api-key: {CLIENT ID}" --header "Authorization: Bearer {ACCESS_TOKEN}" "https://analytics.adobe.io/discovery/me"
- Replace
{ACCESS_TOKEN}
with the access token you copied from the previous step into the above cURL request. - Replace
{CLIENT ID}
in the above request with the client ID from your Oauth client. - Run the cURL command. The following JSON shows an example response:
{
"imsUserId": "1B..OMITTED..01@AdobeID",
"imsOrgs": [
{
"imsOrgId": "EA..OMITTED..29@AdobeOrg",
"companies": [
{
"globalCompanyId": "testco0",
"companyName": "Test Company",
"apiRateLimitPolicy": "aa_api_tier10_tp"
},
{
"globalCompanyId": "anothe0",
"companyName": "Another Test Company",
"apiRateLimitPolicy": "aa_api_tier10_tp"
}
]
},
...
]
}
- Use the
globalCompanyId
value in your response (in the above example, it is shown astestco0
) to test theGET /users/me
endpoint. To do this, replace the{GLOBAL COMPANY ID}
parameters in the following request with their corresponding values. Note that{GLOBAL COMPANY ID}
occurs twice in the following request, once in thex-proxy-company-global-company-id
header and another in the path:
curl -X GET --header "Authorization: Bearer {ACCESS TOKEN} --header "x-proxy-global-company-id: {GLOBAL COMPANY ID}" --header "x-api-key: {CLIENT ID}" "https://analytics.adobe.io/api/{GLOBAL COMPANY ID}/users/me"
- Replace
{ACCESS TOKEN}
and{CLIENT ID}
in the above request with their respective values. - Run the cURL command. The response includes information about the analytics user.
Use your access token
, global company id
and client ID
to make calls to the APIs. You can use the Swagger UI as an easy way to explore calling the Analytics APIs.