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
‎04-28-2021 02:08 AM
Hello,
Are you aware of the StandardCredentialsProvider API:
https://developer.servicenow.com/dev.do#!/reference/api/orlando/server/sn_cc-namespace/standardcredentialsprovider-api
This allows you to retrieve username / password from a credential record.
Let me know if this helps/answers you question.
Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2021 04:15 AM
This would require another step before the REST call, thus requiring me to know which credentials were selected beforehand.
It would also mean hardcoding an ID or having the flow designer pick a credential every time they use the action.
The REST step already knows the credentials as they are attached to the connection. Can't you extract this?
If not, what exactly is the "Credential Value" variable?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2021 06:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2021 09:25 PM
Hi Geoff,
I have a similar issue as the op and attempted to use the credential record to pass the password into the body of a rest call as you've mentioned above. For some reason I am getting access denied when I use the credential record password data pill.
Is the password data pill encrypted or passed as a string?