We have stored the secrets in Beyondtrust Password safe and calling those secrets via Beyond trust API. This secret contains the single backward slash and in the Beyond trust API is escaping it by double backwardslash . This secret is been used for encryption and decryption already the setup /configuration is been done they cannot change the key now. How to handle this?
Hello Nagapriya,
Generally having a backslash in a password or secret should not cause an issue.
What is the error and API call you are making?
Also what scripting language are you using when making your API calls?
Regards,
John
Hello John,
Attached the screenshot from the postman.
In password safe we are saving the secret with 1 backslash but in api it is showing 3 backslashes.
Can you please review this and let me know.
Hello John,
Attached the screenshot from the postman.
In password safe we are saving the secret with 1 backslash but in api it is showing 3 backslashes.
Can you please review this and let me know.
Hello Nagapriya,
The behavior you’re observing is expected. JSON strings represent control characters using escape sequences. The backslash (\
) itself is a control character in JSON strings, and it needs to be escaped by another backslash. That’s why, when displaying JSON in Postman or other programs, you see two backslashes (\\
) instead of one.
You wish to try changing the “Content-Type” header to something not JSON, and see how you get on with the output.
Hi,
I tried to change the content-type to Application/Javascript but i am getting the result in Json format itself.
Hi,
I tried to change the content-type to Application/Javascript but i am getting the result in Json format itself.
Curious - it may be that the API only gives the data in JSON format, but maybe try:
"Content-Type" = "application/x-www-form-urlencoded"
It is still giving the same response with the additional two backward slashes.
It is still giving the same response with the additional two backward slashes.
At this point, it may be worth using something other then Postman to test this - like trying these API calls in PowerShell or even maybe Python. You may get a similar result but you can use addtional programming commands to remove the extra backslashes.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.