Hi, I’m trying to implement API for our invoicing software and we use OAuth 2. I chatted with the AI and I can’t for the love of god figure out how to do this, the docs are sparse if non-existent, forum posts either I can’t find or also doesn’t exist. It has been telling me lots of wild things from probably various platforms probably (Python SDK vs “custom node” code?), I don’t know which are relevant here and which aren’t.
The AI told me it is best to create a custom node to do the OAuth thing. Ok, I guess the input could be client_id, client_secret, the output access_token. Then I could pair it with Call API node and hope Gumloop somehow manages the access token refresh.
Here is probably the best incarnation I can muster right now, it’s syntactically incorrect it appears. Also I can’t find anything credentials related here Run Code - Gumloop so it prolly doesn’t work in custom node context?
from gumloop.decorators import credential
# Our API: https://www.fakturoid.cz/api/v3/authorization#authorization-code-flow
# On our side it wants redirect URL, AI said to use this https://api.gumloop.com/oauth/callback (is that even correct?)
def main(client_id, client_secret, params):
@credential(
name="fakturoid_oauth",
type="oauth2",
config={
"client_id": client_id,
"client_secret": client_secret,
"auth_url": "https://app.fakturoid.cz/api/v3/oauth",
"token_url": "https://app.fakturoid.cz/api/v3/oauth/token",
"scope": "all:read,write"
}
)
def get_access_token(context):
credentials = context.get_credentials()
access_token = credentials.get("access_token")
return access_token
context = where_do_i_get_this
access_token = get_access_token(context)
return access_token
Here’s the node https://www.gumloop.com/custom-nodes/builder?node_id=fAwGmXK7CSjS6XCyTK5pxR
I’m pulling my hair out on this. ![]()
