Accessing OAuth Token (or any credential) from Code Node

Describe the problem/error/question

I want to access an OAuth2 credential that I connected in n8n. But I want to get it into a Code Node so I can call the API directly. Specifically, I want to use it for Google Sheets. The default node is too brittle. I can do everything I want in the code node, but I can’t get access to the OAuth2 credential.

Help???

Running on housed

Hey @Toby_Rush !

Welcome to n8n community!

I don’t believe that the CODE node can do that…

check this relevant post for a “workaround” and great explanation from one of the staff members @jabbson .

Cheers!

Thanks for the quick reply. That’s really disappointing. The code node is so flexible. My challenge is more around a robust way to interact with Google Sheets. The built in Sheets node is brittle. The Google Sheets API does what I want. But accessing it via an HTTP request is a pain.

Any one else have ideas or approaches for accessing a Credential from Code Node?