What This Workflow Does
Facebook access tokens are essential for businesses using Facebook's API to manage pages, run ads, or sync data. However, these tokens expire frequently - short-lived tokens last just 1-2 hours while long-lived versions still expire after 60 days. This creates operational headaches as integrations break when tokens expire.
This n8n workflow automates the conversion of short-lived Facebook tokens to their long-lived versions. It handles the entire token exchange process through Facebook's official OAuth endpoints, saving developers and marketers hours of manual work while ensuring continuous API access for your business applications.
How It Works
1. Input Short-Lived Token
The workflow begins by accepting your existing short-lived Facebook user or page access token. This can be provided manually or pulled from your existing systems where the token is stored.
2. Exchange Token via Facebook API
The workflow makes an authenticated request to Facebook's token exchange endpoint (/oauth/access_token) with your app credentials and short-lived token. Facebook verifies the credentials and returns a long-lived token valid for 60 days.
3. Store the New Token Securely
The generated long-lived token is then stored in your preferred secure storage system - whether that's a database, environment variables, or a secrets management tool. The workflow can be configured to update all systems using this token.
4. Optional Notification
You can configure the workflow to send email or Slack notifications confirming the successful token exchange, including the new expiration date for tracking purposes.
Who This Is For
This workflow benefits any business relying on Facebook API access, including:
- Marketing teams managing Facebook Pages and ads
- Ecommerce stores syncing products with Facebook Shops
- Customer service teams using Messenger integrations
- Developers building Facebook-connected applications
- Agencies managing multiple client Facebook assets
What You'll Need
- A Facebook Developer account and registered app
- Valid short-lived user or page access token
- Facebook app ID and secret
- n8n instance (self-hosted or cloud)
- Secure storage solution for the new token
Quick Setup Guide
- Download the JSON workflow file
- Import into your n8n instance
- Configure Facebook app credentials in the HTTP Request node
- Set up your token storage method (database, variables, etc.)
- Test with a short-lived token to verify functionality
- Schedule the workflow to run before token expiration
Key Benefits
Eliminates manual token renewal: Save 2-3 hours per month that would otherwise be spent manually exchanging tokens through Facebook's developer tools.
Prevents integration downtime: Automated renewal ensures your Facebook-connected systems never lose access due to expired tokens.
Centralized token management: Maintain all tokens in one secure location rather than scattered across different systems.
Scalable solution: Easily manage tokens for multiple pages, users, or clients from a single workflow.
Audit trail: The workflow creates a record of each token exchange for compliance and troubleshooting.