How to retrieve credentials in Flow Designer REST step?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2021 01:23 AM
Hi,
I'm authenticating with a JSON-RPC 2.0 API (Zabbix) inside a Flow Designer Action.
To get an API token, I currently use a REST step to submit username and password to the API:
# POST /api_jsonrpc.php
{
"jsonrpc": "2.0",
"method": "user.login",
"params": {
"user": "ServiceNow",
"password": "password"
},
"id": 1
}
This works fine. But I would like to avoid hardcoding the credentials in the script or supply them as an input to the whole Action.
I do use a Connection Alias. With other authentication methods, you can attach credentials to the alias, but this is not available for JSON-RPC authentication.
Is there another way to retrieve credentials inside the request body?
Thanks!
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2021 04:29 AM
Hi Ty,
The type should be specified on the pill; I believe it is a password 2 type. So you would need to decrypt it using a short script like:
var myPassword = inputs.password;
var encr = new GlideEncrypter();
var decrString = encr.decrypt(myPassword);
gs.info(decrString); // decrypted password
Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2021 02:49 AM
Hi,
Hope this link will help you.
Please mark it as helpful/correct if it helps you.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2021 04:08 AM
This also has hardcoded credentials.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2024 06:17 AM - edited ‎04-19-2024 06:21 AM
So, I had this issue and I spoke to Support, who suggested "its not a natural way to use password2 fields" From my own assumptions, the field is not being decrypted on the fly so it sends the encoded gibberish, which is the wrong value.
So, yes you seem to have to decrypt the value in a script step before using it in the body
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1112530
