Optimize BTG OAuth2 Callback in n8n with Data Table Storage
Optimize BTG OAuth2 Callback in n8n with Data Table Storage
Couldn't load pickup availability
Optimize BTG OAuth2 Callback in n8n with Data Table Storage
Streamline your BTG Empresas OAuth2 integration with this comprehensive n8n workflow that automatically handles authentication callbacks, token exchange, and secure storage in Data Tables. Perfect for developers building financial applications that need reliable BTG API access management.
What this workflow does
This workflow creates a complete OAuth2 callback handler for BTG Empresas authentication:
- Receives GET requests on the
/webhook/btg-callbackendpoint when BTG redirects users after OAuth login - Extracts the authorization code from the callback URL's query parameters
- Exchanges the authorization code for access and refresh tokens via BTG's token endpoint at
https://id.btgpactual.com/oauth2/token - Stores both tokens securely in an n8n Data Table called
btg_tokensusing upsert operations - Returns a JSON success message to the browser confirming authentication completion
Use cases
This BTG OAuth2 workflow is ideal for:
- Financial application developers building integrations with BTG Empresas banking services
- SaaS platforms requiring automated BTG API authentication for their users
- Business automation teams connecting BTG accounts to n8n workflows for financial data processing
- Fintech startups implementing secure token management for BTG Pactual integrations
Technical details
Built with essential n8n nodes:
- Webhook node: Handles BTG OAuth2 callback requests
- Set node: Maps authorization code from query parameters
- HTTP Request node: Exchanges code for tokens with BTG's OAuth2 endpoint
- Data Table nodes: Securely stores access and refresh tokens
- Respond to Webhook node: Returns success confirmation
Setup requires creating a btg_tokens Data Table with key-value columns, registering your n8n webhook URL in BTG's developer portal, and configuring your Base64-encoded client credentials. This workflow ensures your BTG Empresas integration maintains proper OAuth2 compliance while providing reliable token storage and management.
