Segments API auth issue with node.js client

Avatar

Avatar
Validate 1
Level 1
riccardo_malesa
Level 1

Likes

0 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
riccardo_malesa
Level 1

Likes

0 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
riccardo_malesa
Level 1

24-07-2017

Hi,
I'm facing an authorization issue trying to use Segments APIs via a node.js client.

Stop beating around the bush, below the part of it which manages the POST request and the authorization via the x-wsse headers:

var now = new Date();

var options = {

     method: "POST",

     hostname: "api3.omniture.com",

     path: "/admin/1.4/rest/?method=Segments.Get",

     json: true,

     headers: {

            "Content-Type": "application/json",

            "Content-Length" : Buffer.byteLength(JSON.stringify(body)),

            "x-wsse": 'UsernameToken Username="[username]:[company]", PasswordDigest="xxxxxxxxxxxxxxxxxxxxxxxxxx==", Nonce="yyyyyyyyyyyyyyyyyyyyyyyyyy", Created="'+now+'"'

     }

};

As you see, I'm trying to replicate the x-wsse generated by the API Explorer, dynamically specifying the Created timestap via Date() JS class.

Node client is reporting me this error:

"{"error":"Bad Request","error_description":"Unable to validate authentication.","error_uri":null}"

I suppose the x-wsse PasswordDigest and Nonce values also continuously change at every request while here I put them static.

If this was the reason for the issue, how dynamically insert also those parameters in the x-wsse header ?

Thanks a lot.

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar
Validate 1000
Community Manager
jantzen_belliston-Adobe
Community Manager

Likes

339 likes

Total Posts

2,331 posts

Correct reply

819 solutions
Top badges earned
Validate 1000
Springboard
Validate 500
Validate 250
Validate 100
View profile

Avatar
Validate 1000
Community Manager
jantzen_belliston-Adobe
Community Manager

Likes

339 likes

Total Posts

2,331 posts

Correct reply

819 solutions
Top badges earned
Validate 1000
Springboard
Validate 500
Validate 250
Validate 100
View profile
jantzen_belliston-Adobe
Community Manager

05-03-2021

Since this is an older post, I'm assuming you've solved this issue. Incase others find this post, I'll post the link to the documentation below:

https://www.adobe.io/apis/experiencecloud/analytics/docs.html#!AdobeDocs/analytics-2.0-apis/master/s...