Too short user for http request

Hi, I am trying to use http request node to acquire a token specified for a service(Based on IBM). The curl format is specified as:

curl "https://iam.ng.bluemix.net/identity/token" -d "apikey=12345678&grant_type=urn%3Aibm%3Aparams%3Aoauth%3Agrant-type%3Aapikey" -H "Content-Type: application/x-www-form-urlencoded" -u "bx:bx"

The Issue is that the user is too small for the fields within the request node in Node-Red, if I enter "bx" for the password it is replaced by something different.

Also I am a little unsure how to set the payload so it matches the specification. I have tried:

msg.payload="apikey=12345678gk&grant_type=urn%3Aibm%3Aparams%3Aoauth%3Agrant-type%3Aapikey";

Where obviously I entered my own apikey instead of 12345678.

Any help is appreciated,

Dillon

we replace the password with a dummy value so that value "visible" in the browser cannot be scraped. The value saved on the server side is the value you typed and is not replaced.

Okay, so it still should be "bx" if I typed it?

I have the flow:


with the function set as follows:

However, it gives an empty output instead of a large token as expected.
image

I tried the format in the cmd window and it works

You should probably set payload to a key/value object:

msg.payload= {
   apikey: "12345678gk",
   grant_type="urn:ibm:params:oauth:grant-type:apikey"
};

I did, still empty result. A little strange.Can Node-red retrieve the IAM tokens for IBM? This is the requests task.