Click HERE to see how Saviynt Intelligence is transforming the industry. |
07/22/2024 10:59 PM
Hi,
I am working on REST integration where access_token is not picking dynamically in other jsons like create and addaccess json.
PFA connection json i am pasting below used dummby valued wherevered required
{"authentications":{"acctAuth":{"authType":"oauth2","httpHeaders":{"Content_Type":"application/x-www-form-urlencoded"},"authError":["Unable to authenticate the client","Invalid OAuth token Bearer"],"url":"https://abcd.auth.marketingcloudapis.com/v2/Token","httpMethod":"POST","httpContentType":"application/x-www-form-urlencoded","errorPath":"","maxRefreshTryCount":5,"tokenResponsePath":"access_token","tokenType":"Bearer","authHeaderName":"Authorization","accessToken":"abcd","httpParams":{"grant_type":"client_credentials","client_secret":"abcd","client_id":"abcd"},"retryFailureStatusCode":[401,403,500]}}}
Solved! Go to Solution.
07/22/2024 11:47 PM
Hi @UtkarshSingh what is the error you're seeing? Also, can you share the sample API response from postman for the access token endpoint?
07/23/2024 03:28 AM
{"auditDetails":{"Role":[{"headers":null,"message":"","statusCode":null,"description":null,"status":"Failed"}]},"Role":{"headers":null,"message":"","statusCode":null,"description":null,"status":"Failed"}}
07/23/2024 03:31 AM
Please share postman screenshot and curl command [Refer https://codingnconcepts.com/postman/how-to-generate-curl-command-from-postman/ ]
⚠️‼️‼️Do not upload any attachments that contain sensitive information, such as IP Addresses, URLs, Company/Employee Names, Email Addresses, etc.‼️‼️⚠️
{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"httpHeaders": {
"Content_Type": "application/x-www-form-urlencoded"
},
"authError": [
"Unable to authenticate the client",
"Invalid OAuth token Bearer"
],
"url": "https://abcd.auth.marketingcloudapis.com/v2/Token",
"httpMethod": "POST",
"httpContentType": "application/x-www-form-urlencoded",
"errorPath": "",
"maxRefreshTryCount": 5,
"tokenResponsePath": "access_token",
"tokenType": "Bearer",
"authHeaderName": "Authorization",
"accessToken": "abcd",
"httpParams": {
"grant_type": "client_credentials",
"client_secret": "abcd",
"client_id": "abcd"
},
"retryFailureStatusCode": [ null,
401,
403,
500
]
}
}
}
07/23/2024 07:44 PM
curl --location 'https://abcd.marketingcloudapis.com/v2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=abcd' \
--data-urlencode 'client_secret=abcd' \
--data-urlencode 'grant_type=client_credentials'
07/23/2024 08:01 PM
Hi @UtkarshSingh try with the below JSON. Please add a GET call in the testConnectionParams to and validate in the logs when you hit "Save and Test Connection". Let me know the result.
{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"url": "https://abcd.marketingcloudapis.com/v2/token'",
"httpMethod": "POST",
"httpParams": {
"grant_type": "client_credentials",
"client_id": "abcd",
"client_secret": "abcd"
},
"httpContentType": "application/x-www-form-urlencoded",
"httpHeaders": {
"Content-Type": "application/x-www-form-urlencoded"
},
"retryFailureStatusCode": [
401,
403
],
"expiryError": "ExpiredAuthenticationToken",
"authError": [
"SESSION_NOT_VALID",
"AuthenticationFailed",
"ExpiredJwtException",
"401 Unauthorized"
],
"timeOutError": "Read timed out",
"errorPath": "code",
"maxRefreshTryCount": 6,
"tokenResponsePath": "access_token",
"tokenType": "Bearer",
"accessToken": "abcd",
"testConnectionParams": {
"http": {
"url": "https://xxxxxxxx",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"httpMethod": "GET"
},
"successResponse": [],
"successResponsePath": "",
"errors": [
"Couldn't authenticate you"
],
"errorPath": "error"
}
}
}
}
07/23/2024 08:14 PM - edited 07/24/2024 07:21 PM
{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"httpHeaders": {
"Content-Type": "application/x-www-form-urlencoded"
},
"authError": [
"Unable to authenticate the client",
"Invalid OAuth token Bearer"
],
"url": "https://abcd.auth.marketingcloudapis.com/v2/Token",
"httpMethod": "POST",
"httpContentType": "application/x-www-form-urlencoded",
"errorPath": "",
"maxRefreshTryCount": 5,
"tokenResponsePath": "access_token",
"tokenType": "",
"authHeaderName": "Authorization",
"accessToken": "Bearer abcd",
"httpParams": {
"grant_type": "client_credentials",
"client_secret": "abcd",
"client_id": "abcd"
},
"retryFailureStatusCode": [ null,
401,
403,
500
]
}
}
}
07/24/2024 07:06 PM
it worked after removing bearer from token type
07/24/2024 07:21 PM
Updated response
✅Please click the 'Accept As Solution' button on the reply (or replies) that best answered your original question and hit 'Kudos' button 👍.
07/24/2024 02:52 AM
Hi Rushi same error status code null