# Too short user for http request

**URL:** <https://discourse.nodered.org/t/too-short-user-for-http-request/11359>\
**Category:** General\
**Created:** [21 May 2019 11:28 UTC](https://discourse.nodered.org/t/too-short-user-for-http-request/11359 "2019-05-21T11:28:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DillonW](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@DillonW](https://discourse.nodered.org/u/DillonW)\
**Post date:** [21 May 2019 11:28 UTC](https://discourse.nodered.org/t/too-short-user-for-http-request/11359/1 "2019-05-21T11:28:19Z")

</div>

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:

```auto
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:

```auto
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

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [21 May 2019 12:00 UTC](https://discourse.nodered.org/t/too-short-user-for-http-request/11359/2 "2019-05-21T12:00:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![DillonW](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@DillonW](https://discourse.nodered.org/u/DillonW)\
**Post date:** [21 May 2019 12:13 UTC](https://discourse.nodered.org/t/too-short-user-for-http-request/11359/3 "2019-05-21T12:13:36Z")

</div>

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

I have the flow:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/0de40e0dbf57d95e701b33270025dd36ed5698fc.png)  
with the function set as follows:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/d/d6c123e82cbe5f9b9479dea6870789b299e6f16d.png)  
However, it gives an empty output instead of a large token as expected.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/ee4f7da2a6a830ea3258e607674b924cebebf9c6.png)

I tried the format in the cmd window and it works

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [21 May 2019 12:18 UTC](https://discourse.nodered.org/t/too-short-user-for-http-request/11359/4 "2019-05-21T12:18:27Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![DillonW](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@DillonW](https://discourse.nodered.org/u/DillonW)\
**Post date:** [21 May 2019 15:03 UTC](https://discourse.nodered.org/t/too-short-user-for-http-request/11359/5 "2019-05-21T15:03:16Z")

</div>

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