Google Cloud Workflow - Fetch Bearer Token Step

445 Views Asked by At

In my use case I want to create a step in Google Cloud Workflow where I can pass my username and password and return the resultant bearer token in a variable. Was wondering how the yaml config for such a workflow would look like ?

My endpoint expects a request in the following manner :

POST 'https://cloud.business.io/v2/login'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode '[email protected]'
--data-urlencode 'password=APassword123'

1

There are 1 best solutions below

1
On

Found it with a little trial and error !

call: http.post
args:
    url: https://cloud.business.io/v2/login
    headers:
        'Content-Type': 'application/x-www-form-urlencoded'
    body :
        'username': '[email protected]'
        'password': 'APassword123'
result: BearerToken