Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

how to get token from headers

09
New Contributor III
New Contributor III

Hi Team,

In create ticket json am getting an error "unable creation access token" because I have rest connection with token in response headers. I have followed the rest connector doc and tried the below format but am getting an error "unable creation access token".

  "tokenResponsePath": "#HEADERS#Authentication-Token",

 

Logs :

 

DEBUG services.HttpClientUtilityService  - got response for api..."
"ecm-worker","2024-01-02T03:46:27.836+00:00","2024-01-02T03:46:27.816009379Z stdout F 2024-01-02 03:46:27,815 [quartzScheduler_Worker-9] DEBUG rest.RestUtilService  - Got showLogs = true"
"ecm-worker","2024-01-02T03:46:27.836+00:00","2024-01-02T03:46:27.816049279Z stdout F 2024-01-02 03:46:27,815 [quartzScheduler_Worker-9] DEBUG rest.RestProvisioningService  - Got Webservice API Response: [headers:[X-Frame-Options: DENY, Strict-Transport-Security: max-age=31536000; includeSubDomains, Cache-Control: no-store, X-Content-Type-Options: nosniff, Content-Security-Policy: script-src 'self' 'unsafe-inline' 'unsafe-eval' https://*, Pragma: no-cache, X-XSS-Protection: 1; mode=block, Set-Cookie: JSESSIONID=****; Path=/baocdp; Secure; HttpOnly, Set-Cookie: Authentication-Token=******; Path=/baocdp; Secure; HttpOnly, Authentication-Token: *******, Content-Type: application/json;charset=UTF-8, Transfer-Encoding: chunked, Date: Tue, 02 Jan 2024 03:46:27 GMT, Keep-Alive: timeout=60, Connection: keep-alive, Server: platform-web-server], responseText:{"login":"true"}, cookies:[JSESSIONID=*****; Path=/baocdp; Secure; HttpOnly, Authentication-Token=*******; Path=/baocdp; Secure; HttpOnly], statusCode:200]"

 

 connection JSON:

 

{
  "authentications": {
    "userAuth": {
      "authType": "oauth2",
    "url": "https://removed/rest/login",
      "httpMethod": "POST",
       "httpParams": "{\"username\":\"ffff\",\"password\": \"Hy1\"}",
      "httpContentType": "application/json",
      "httpHeaders": {
        "Content-Type": "application/json"
      },
      "maxRefreshTryCount": 5,
      "tokenResponsePath": "#HEADERS#Authentication-Token",
      "authHeaderName": "Authentication-Token",
  "tokenType": "",
      "accessToken": "AAAADN",
      "retryFailureStatusCode": [
        401
      ]
    }
  }
  
}

 

createTicketJSon

{"call":[{"name":"call1","connection":"userAuth","url":"https://removed/rest/update ","httpMethod":"POST","httpContentType":"application/json","ticketidPath":"response.data.id","httpHeaders":{"Content-Type":"application/json", "Authentication-Token":"${access_token}"}}}]}

[This message has been edited by moderator to mask sensitive info]

8 REPLIES 8

rushikeshvartak
All-Star
All-Star

try below JSON

 

{
"authentications": {
"userAuth": {
"authType": "oauth2",
"url": "https://10/dp/rest/login",
"httpMethod": "POST",
"httpParams": "{\"username\":\"ffff\",\"password\": \"Hy1\"}",
"httpContentType": "application/json",
"httpHeaders": {
"Content-Type": "application/json"
},
"maxRefreshTryCount": 5,
"tokenResponsePath": "#HEADERS#Set-Cookie",
"authHeaderName": "Authentication-Token",
"tokenType": "",
"accessToken": "AAAADN",
"retryFailureStatusCode": [
401
]
}
}

}


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

09
New Contributor III
New Contributor III

i did tried the above json. However its not populating the Authentication-Token header in createTicketJSon.

createTicketJSon:

{"call":[{"name":"call1","connection":"userAuth","url":"https://removed/rest/update ","httpMethod":"POST","httpContentType":"application/json","ticketidPath":"response.data.id","httpHeaders":{"Content-Type":"application/json", "Authentication-Token":"${access_token}"}}}]}

 

ERROR LOGS:


Got Webservice API Response: [headers:[X-Frame-Options: DENY, Strict-Transport-Security: max-age=31536000; includeSubDomains, Cache-Control: no-store, X-Content-Type-Options: nosniff, Content-Security-Policy: script-src 'self' 'unsafe-inline' 'unsafe-eval' https://*, Pragma: no-cache, X-XSS-Protection: 1; mode=block, X-Powered-By: JSF/1.2, Content-Type: application/json;charset=UTF-8, Content-Language: en-US, Transfer-Encoding: chunked, Date: Tue, 02 Jan 2024 07:04:08 GMT, Keep-Alive: timeout=60, Connection: keep-alive, Server: platform-web-server], responseText:

 

createTicketJSon:

{"call":[{"name":"call1","connection":"userAuth","url":"https://removed/rest/update ","httpMethod":"POST","httpContentType":"application/json","ticketidPath":"response.data.id","httpHeaders":{"Content-Type":"application/json", "Authorization":"${access_token}"}}}]}


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Share response text - responseText

and when credentials are wrong what is response from postman ?


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

09
New Contributor III
New Contributor III

The target endpoint basically works with Authentication-Token.

please refer the below link API Responses (Login & Execute process asynchronously)

 

REF:

https://docs.bmc.com/docs/TrueSightOrchestrationPlatform/222/rest-api-truesight-orchestration-call-e...

09
New Contributor III
New Contributor III

Team, any update on this? is this a bug?

09
New Contributor III
New Contributor III

token is in headers PFA postman Authentication-Token

{
"authentications": {
"userAuth": {
"authType": "oauth2",
"url": "https://10/dp/rest/login",
"httpMethod": "POST",
"httpParams": "{\"username\":\"ffff\",\"password\": \"Hy1\"}",
"httpContentType": "application/json",
"httpHeaders": {
"Content-Type": "application/json"
},
"maxRefreshTryCount": 5,
"tokenResponsePath": "#HEADERS#Set-Cookie",
"authHeaderName": "Authentication-Token",
"tokenType": "",
"access_token": "Authentication-Token abc",
"accessToken": "AAAADN",
"retryFailureStatusCode": [
401
]
}
}
}


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.