Odd problem with Bearer Authentication

Hi, I am still struggling with this.

First of all, this works:

curl -i -X PUT -H 'Authorization: Bearer xxxxxxxxxxxx' -H 'Content-Type: application/json' -d '{"id": "xxxxxxxxxxxxxxxx", "message": "I edited this"}' https://xxxxxxxxxxxxx/api/v4/posts/xxxxxxxxxxxxxxxxxxxx

Now, whenever I try and do this from NodeRed, i get 403 with payload

"{"id":"api.context.permissions.app_error","message":"You do not have the appropriate permissions.","detailed_error":"","request_id":"caywpjumijbqdr8jagwd68dwhc","status_code":403}"
  • I have tried enabling User authentication set to bearer and passing the token
  • I have tried passing the Authorization header via the UI
  • I have tried passing all headers via code
    var idToken = "xxxxxxxxxxxxxxxxxx"
    
    msg.headers = {}
    msg.headers['Authorization'] = "Bearer " + idToken
    msg.headers['Content-Type'] = "application/json" 
    
  • I have tried passing headers via code, keeping Basic authentication with empty user and psw

None of these approaches works. Hope someone can help me out

EDIT: the issue was not with Node-RED but with another service API. I can confirm that passing the bearer via code works just fine