Destination SDK Failing because of invalid Auth token(Authencation Failed) | Community
Skip to main content
Level 2
June 15, 2026
Question

Destination SDK Failing because of invalid Auth token(Authencation Failed)

  • June 15, 2026
  • 12 replies
  • 68 views

we are trying to create a destination sdk to swoogo faccing issue which authentication type to use had tried OAuth 2 with Client Credentials Grant it is not working please suggest what kind of customerauthentication to be used for these destination .
below for swoogo request api token for refernce :
https://swoogo.readme.io/reference/post_oauth2-token
Swoogo Api:
https://swoogo.readme.io/reference/updatecontact
these was used in our config json it was not working:

 "customerAuthenticationConfigurations": [

   {

      "authType": "OAUTH2",

      "grant": "OAUTH2_CLIENT_CREDENTIALS",

      "accessTokenUrl": "https://api.swoogo.com/api/v1/oauth2/token",

      "clientId": "XXXXX",

      "clientSecret": "XXXXXXXXXXXXXX",

      "options": {

        "useBasicAuth": true

      }

    }  

  ],

12 replies

RrffggAuthor
Level 2
June 19, 2026

Hi ​@DineshK 
Thanks for reply but is there way to send segment name instead of segment id because segmentid  not helps much to identitfy which profiles belong to which segment in sfmc .
and also why to add feilds schemaConfig.profileFields: here as these from backend automatically will  ingest input.aggregationKey.segmentId  because of these 
if we add here schemaConfig.profileFields that feilds comes up in right side  mapping ui but what we should map from left side .

DineshK
Level 2
June 19, 2026

Two good points you raised.

Sending segment name instead of segment ID

Yes you can. Update your server template request body with this:

 

"requestBody": {
"templatingStrategy": "PEBBLE_V1",
"value": "{\n \"items\": [\n {% for profile in input.profiles %}\n {\n \"firstname\": \"{{ profile.attributes.firstname }}\",\n \"lastname\": \"{{ profile.attributes.lastname }}\",\n \"emailaddress\": \"{{ profile.attributes.emailaddress }}\",\n \"segmentName\": \"{{ destination.namespaceSegmentNames[input.aggregationKey.segmentNamespace][input.aggregationKey.segmentId] }}\",\n \"segmentStatus\": \"{{ input.aggregationKey.segmentStatus }}\"\n }{% if not loop.last %},{% endif %}\n {% endfor %}\n ]\n}"
}

The SDK automatically resolves the actual segment name from AEP at runtime — so whatever you've named your segment in AEP, that's exactly what lands in SFMC. No hardcoding needed. segmentStatus will tell you whether the profile entered (realized) or left (exited) the segment, which is useful for suppression logic in SFMC.

Before testing — make sure your SFMC Data Extension has these two columns added:

  • segmentName (Text)
  • segmentStatus (Text)

If those columns don't exist in the DE, the values will be silently dropped and you won't see any error.

On your schemaConfig.profileFields question — you're right, you don't need to add anything there

profileFields is only for profile attributes that need to show up in the AEP mapping UI — like firstname, lastname, emailaddress where you're manually mapping an AEP attribute to a destination field.

segmentName and segmentStatus are resolved automatically by the SDK from the aggregation context at export time. They don't come from the profile, they come from the segment itself — so there's nothing to map and nothing to add to profileFields. Your aggregation config already has includeSegmentId: true and includeSegmentStatus: true which is all that's needed for these variables to work.

Just update the server template and add the two columns in SFMC. 

Let me know how it goes. 

RrffggAuthor
Level 2
June 19, 2026

 Hi ​@DineshK 
segement name is ingesting to sfmc thanks for your suggestion .
 I had one more question we are using sftp to send the files csv to sftp location in that in mapping to get segment name for profiles can we use caluclate feild there we give something like that which we used in destination sdk .i tried using these error is coming
 

There was a problem preparing mappings.

Bad request parameters or payload. Please check your request and try again. Additional detail: The attribute input.aggregationKey.segmentId does not exist in input schema. Please update the source schema path and try again.The attribute input.aggregationKey.segmentNamespace does not exist in input schema. Please update the source schema path and try again.', The attribute destination.namespaceSegmentNames[v("input.aggregationKey.segmentNamespace")v("input.aggregationKey.segmentId")] does not exist in input schema. Please update the source schema path and try again.',
 

so is these possible here to get segment name for these csv file export what should be there in caluclated feild .please help on these