name.toLowerCase is not a functiom

please help. i am trying to get the access token with a http request (post) and the msg.payload has the cfedentials, but I get the error below

my flow
image
My credentials

the error
error
name: "TypeError"
message: "name.toLowerCase is not a function"
stack: "TypeError: name.toLowerCase is not a function↵ at normaliseKnownHeader

Hi and welcome to the forum.

As you may know you have (for now) limited posts before you are blocked.

Open the function node, select all the code and paste it in your original post.

BEFORE YOU POST IT!

See the little button up the top </>?

Click it, then paste the code
Where it says type or paste code here.
(See below)

type or paste code here

Ummmm....

Actually I am not sure what I just said is going to help, as I now see there isn't much code in there anyway.

If you are sending your credentials...... Sometimes, some tokens require UPPERCASE letters.

Where are you seeing the error?
How do you know it is coming from the function node?

AND!

Now looking at it a bit more!

I'd not post your credentials.
That is a HUGE security issue for you.

I'm not saying people HERE are nasty, but this is a PUBLIC forum, and OTHER PEOPLE can also see this information!

WARNING!

Please delete the picture ASAP!

(Your call)

hey dude sorry about that - the client id and secret was posted but i left out the url ( :zany_face:)
i used chat GPT and the problem was that I was placing msg.payload in the headers section of the HTTP REQUEST node. msg.payload is automatically passed to body of the HTTP REQUEST node in my credential function i had to define like this the headers part:
Chat GPT resolved my problem with code below - thanks

msg.method = "POST";
msg.url = "https://xxxxxxxconnect/token";

msg.headers = {
  "Content-Type": "application/x-www-form-urlencoded",
  "Accept": "application/json"
};

msg.payload =
  "grant_type=client_credentials" +
  "&client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +
  "&client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

return msg;

(You could have just added that reply to the original post, but......)

I'm not sure where the problem is happening.

I may have to hope someone else smarter than me can see what I'm missing.