Describe the issue/error/question
I’m having a weird behavior when setting a bearer token with expression. Basically the expression is “Bearer {{$node[“Get Agency Keys”].json[“highLevelKey”]}}”.
The resultant value looks correct but I get the error {“msg”:“Unauthorized”} when the request is made.
Here is the part that seems odd. If I copy the token from the expression result window below the expression, then paste it in the expression as a hard-coded value, then the request works.
So I have confirmed the token value itself is not the issue.
The source node for the token is called only once so it’s not changing on each call.
I don’t see any extra leading or trailing spaces.
The token itself is static, not needing to be refreshed.
Is there something obvious I could be missing?
What is the error message (if any)?
{“msg”:“Unauthorized”}
Please share the workflow
Share the output returned by the last node
[
{
"id": "Tab2YgfUYkZTRRmdYgd1Bb”,
"locationId": "PabQkbmGYgaYXiOxFJXSNc”,
"contactName": “joe smith”,
"firstName": “joe”,
"lastName": “smith,
"companyName": “Acme Co.”,
"email": “[email protected],
"phone": "+15555555555”,
"dnd": false,
"type": "customer",
"source": "sub account user",
"assignedTo": null,
"city": null,
"state": null,
"postalCode": null,
"address1": null,
"dateAdded": "2022-11-04T16:47:59.125Z",
"dateUpdated": "2022-11-18T15:32:49.767Z",
"dateOfBirth": null,
"tags": [
"sub-account-user"
],
"lastActivity": 1667580481764,
"customField": [
{
"id": "YYyy5LNzidDh9UefuBmX",
"value": "xfpHOGL1uuku3GKVyd7b"
},
{
"id": "userId",
"value": "ny0raTuYfOqzELSCz8rL"
},
{
"id": "IIRzhyjPfEHP6rtb0kV8",
"value": "admin"
},
{
"id": "KgbBylJ15PEUccMpwMZ3",
"value": "account"
}
],
"userId": "ny0raTuYfOqzELSCz8rL"
},
{
"id": "rabDXZiGQEgKM6wuf26ZdO",
"locationId": "PabQkbmGYgaYXiOxFJXSNc",
"contactName": “harry potter”,
"firstName": “harry”,
"lastName": "potter,
"companyName": “Fake Company inc.”,
"email": “[email protected]”,
"phone": null,
"dnd": false,
"type": "customer",
"source": "sub account user",
"assignedTo": null,
"city": null,
"state": null,
"postalCode": null,
"address1": null,
"dateAdded": "2022-11-03T16:51:06.498Z",
"dateUpdated": "2022-11-18T15:32:50.208Z",
"dateOfBirth": null,
"tags": [
"sub-account-user",
"add-user-membership"
],
"customField": [
{
"id": "YYyy5LNzidDh9UefuBmX",
"value": "be1gN9XKwIQrdlStYdfW"
},
{
"id": "usertId",
"value": "u2fq4NE6HXoL2XkfUhN2"
},
{
"id": "IIRzhyjPfEHP6rtb0kV8",
"value": "user"
},
{
"id": "KgbBylJ15PEUccMpwMZ3",
"value": "account"
}
],
"userId": "u2fq4NE6HXoL2XkfUhN2"
}
]
Information on your n8n setup
- n8n version: 0.202.1
- Database you’re using (default: SQLite): SQLLite
- Running n8n with the execution process [own(default), main]: ?
- Running n8n via [Docker, npm, n8n.cloud, desktop app]: Elestio VM