Passing Bearer Token Not Working

I was trying to pass the API key from a function:
msg.headers = {};
msg.headers['Authorization'] = "Bearer "+ msg.payload.token;
return msg;

I keep on getting 401 error.
But when I copied the entire API key to the http request node > Token field it works without problem.

What seems to be the problem here?

But when I switched it to "basic authentication", everything works!
This is weird.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.