Smappee with node red

Hi,

I want to connect to smappee via api but I need to first create an access token via an http post request

This is the info they gave

Use your application’s credentials and the user’s credentials to retrieve an access token by sending a HTTP POST message to https://app1pub.smappee.net/dev/v1/oauth2/token

POST /dev/v3/oauth2/token HTTP/1.1
Host: app1pub.smappee.net
Content-Type: application/x-www-form-urlencoded;charset=UTF-8

grant_type=password&
client_id=[YOUR_APP_ID]&
client_secret=[YOUR_CLIENT_SECRET]&
username=[USER_NAME]&
password=[USER_PASSWORD]

Can someone help how the node red nodes should be configured ?

Something like

image

[{"id":"ccc0b95e6ce0e6c2","type":"http request","z":"120358abd7c22d30","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"https://app1pub.smappee.net/dev/v1/oauth2/token","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"other","keyValue":"Content-Type","valueType":"other","valueValue":"application/x-www-form-urlencoded"},{"keyType":"other","keyValue":"charset","valueType":"other","valueValue":"UTF-8"}],"x":916,"y":2480,"wires":[["9d7ff0af827fcad5"]]},{"id":"3295867f50e4472f","type":"inject","z":"120358abd7c22d30","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"grant_type\":\"password\",\"client_id\":\"[YOUR_APP_ID]\",\"client_secret\":\"[YOUR_CLIENT_SECRET]\",\"username\":\"[USER_NAME]\",\"password\":\"[USER_PASSWORD]\"}","payloadType":"json","x":746,"y":2480,"wires":[["ccc0b95e6ce0e6c2"]]},{"id":"9d7ff0af827fcad5","type":"debug","z":"120358abd7c22d30","name":"debug 189","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1114,"y":2480,"wires":[]}]

Hi thanks,

How should I add the other fields.
Sorry for this maybe stupid question but this is the first time I try to do something like this.
I expect the other parameters to be part of the body but I don’t see options to add it.

Look in the inject node. You pass them to the request node via msg.payload as a JSON object.

Thanks a lot. I finally got the access token.
I should have known better to check the inject node.
I tested something myself but used string. So close but also so far away. You made my day.

Let see if I can figure out the next steps.