Forum Discussion

vinayyadav's avatar
vinayyadav
New Contributor
6 years ago

Unwanted char ? while transferring a OAuth WRAP token thru property transfer

In step 1, I am hitting an API to generate an OAuth WRAP token. Here is sample response of the API:

 

In Step 2, I am Decoding this response using the following script:

 

import groovy.json.JsonSlurper def slurper = new JsonSlurper() //get the response data from a test step String urlParameters = testRunner.testCase.getTestStepByName("GetAuthToken").getPropertyValue("response") String token = URLDecoder.decode(urlParameters); token = token.replaceAll("wrap_access_token=","wrap access_token="); newtoken = token.replaceAll("&wrap_access_token_expires_in=7201",""); return newtoken;

 

Here is the response of this decode step:

Script-result: wrap access_token=MAIL360.GivenName=John&MAIL360.Surname=Doe&MAIL360.FullName=John Doe&MAIL360.Email=john.doe@nowhere.com&MAIL360.Org=1&MAIL360.OrgRoles[1].Org=1&MAIL360.OrgRoles[1].R... In Step3, I am Transfering this decoded token to the following API request using Property Transfer. GET https://localhost:8884/mail360/mailpieceSets?eKey1=9999999990 HTTP/1.1 Authorization: wrap access_token=MAIL360.GivenName=John&MAIL360.Surname=Doe&MAIL360.FullName=John Doe&MAIL360.Email=john.doe@nowhere.com&MAIL360.Org=1&MAIL360.OrgRoles[1].Org=1&MAIL360.OrgRoles[1].R...

 

But in the request of API, an unwanted character ? is appearing just before the transferred token value. Like

Authorization: ?wrap access_token Please help how i can avoid this character.

No RepliesBe the first to reply