How to Access Bearer Token and Store as Variable

Hi,

I have a workflow where I am simply connecting to Quickbooks Online’s API.

That’s it.

I want to get the Access Token (Bearer Token) from my credential and store it as a variable.

All of my Quickbooks API calls work, but I cannot find a way to get this token.

The reason is because I want to pass this access token to AWS Lamba to then do a bunch of data filtering and then make the API calls from there. I don’t want to host a webserver so the authentication part is great with n8n as long as I can get this value.

I have created both a predefined credential as well as a generic one which both connect to the same account.

I would really appreciate any help!

Hi @DBurkAutomized, welcome to the community!

n8n has an easy way of attaching OAuth2 tokens to an HTTP Request, but not for fetching them I am afraid. However, with this in mind you could build a workflow that send an HTTP request to a webhook node URL using your OAuth2 credentials. The receiving webhook node would get the actual token via the Authorization header:

2 Likes

Thank you for your response!

1 Like

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