Hello,
I'm pretty new to workato and not quite familiar with Ruby.
I need to write a custom connector that authenticates using a POST request passing username/password and receives back an auth token; the Token will then be used in the header of following requests; I'm struggling in identifying the correct form to write the "authorization" block of the "connection" section; I've tried using the following:
"connection": {
"fields": [
{
"name": "username",
"label": "Username",
"hint": "Enter HDA username for authentication.",
"optional": false
},
{
"name": "password",
"label": "Password",
"control_type": 'password',
"hint": "Enter your password for authentication.",
"optional": false
},
{
"name": "BaseURL",
"label": "Base URL",
"control_type": 'URL',
"hint": "Enter base URL for HDA integration.",
"optional": false
}
],
"authorization": {
"type": "custom_auth",
"acquire": {
"code": {
"post": {
"headers": {
"Content-Type": "application/json"
},
"payload": {
"username": "::username::",
"password": "::password::"
},
"response_format": "json"
},
"response_mapping": {
"token": "token"
}
}
},
"apply": {
"headers": {
"Authorization": "::token::"
}
}
}
},
test: lambda do |_connection|
get("::BaseURL::")
end,
But I get the following error: Expected lambda for 'acquire' in hooks but got hash.
Any hint or suggestion?
Thanks a lot,
Giordano