AutomationFlowsSocial Media › Get Long-Lived Facebook Access Token

Get Long-Lived Facebook Access Token

Original n8n title: Get Long Lived Facebook User or Page Access Token

Get Long Lived Facebook User Or Page Access Token. Uses manualTrigger, httpRequest, stickyNote. Event-driven trigger; 5 nodes.

Event trigger★★☆☆☆ complexity5 nodesHTTP Request
Social Media Trigger: Event Nodes: 5 Complexity: ★★☆☆☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "nodes": [
    {
      "id": "2a5077ad-89ee-4659-93a9-e01bcceba0ad",
      "name": "When clicking \u2018Test workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        480,
        280
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e2c7ce4c-fbf9-4552-8a9e-5b41d72c8921",
      "name": "Get Long Lived FB User Token",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1000,
        280
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v20.0/oauth/access_token",
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        },
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": " grant_type",
              "value": "fb_exchange_token"
            },
            {
              "name": " client_id",
              "value": "={{ $json[' client_id'] }}"
            },
            {
              "name": " client_secret",
              "value": "={{ $json[' client_secret'] }}"
            },
            {
              "name": " fb_exchange_token",
              "value": "={{ $json.user_access_token }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "4e898760-43cd-4d4f-a76c-555175fb2a27",
      "name": "Get Long Lived FB Page Token",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1280,
        280
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v20.0/{{ $('Set Parameter').item.json.app_scoped_user_id }}/accounts",
        "method": "=GET",
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        },
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": " access_token",
              "value": "={{ $json.body.access_token }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "6ac48498-014f-4721-9629-acd3bd1329e7",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        -87.08653868552273
      ],
      "parameters": {
        "width": 260.14166686078653,
        "height": 552.0076928452548,
        "content": "## Set Required Facebook Parameter \n- client_id\n- client_secret\n- user_access_token\n- app-scoped-user-id (optional)\n\n## according to this doc\n https://developers.facebook.com/docs/facebook-login/guides/access-tokens/get-long-lived/"
      },
      "typeVersion": 1
    },
    {
      "id": "11a68266-f7ec-4c56-9327-c4fd0e4478f6",
      "name": "Set Parameter",
      "type": "n8n-nodes-base.set",
      "position": [
        700,
        280
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b1f6b8a1-dc25-4b1e-9aa3-0c0e452ae2de",
              "name": " client_id",
              "type": "string",
              "value": "xxxx"
            },
            {
              "id": "9a63879a-c359-49ad-9fec-19c9e4c78dd6",
              "name": " client_secret",
              "type": "string",
              "value": "yyyy"
            },
            {
              "id": "6971a841-ed5e-4d96-bdab-1eaec2d51ccc",
              "name": "user_access_token",
              "type": "string",
              "value": "zzzzz"
            },
            {
              "id": "c75d5e50-62ea-4ee0-bfaa-5f79cf4d147e",
              "name": "app_scoped_user_id",
              "type": "string",
              "value": "uuuuuu"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "connections": {
    "Set Parameter": {
      "main": [
        [
          {
            "node": "Get Long Lived FB User Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Long Lived FB User Token": {
      "main": [
        [
          {
            "node": "Get Long Lived FB Page Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Test workflow\u2019": {
      "main": [
        [
          {
            "node": "Set Parameter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Get Long Lived Facebook User Or Page Access Token. Uses manualTrigger, httpRequest, stickyNote. Event-driven trigger; 5 nodes.

Source: https://github.com/Zie619/n8n-workflows — original creator credit. Request a take-down →

More Social Media workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Social Media

This n8n workflow allows users to submit a YouTube video URL, automatically fetches multiple MP4 and MP3 download links using YouTube Video Downloader Fast API. It logs all links into Google Sheets fo

HTTP Request, Form Trigger, Google Sheets
Social Media

Instagram Profile Scraper. Uses formTrigger, httpRequest, googleSheets. Event-driven trigger; 8 nodes.

Form Trigger, HTTP Request, Google Sheets
Social Media

Convert YouTube videos into SEO-friendly blog posts in just seconds using this fully automated n8n workflow. Perfect for content creators, marketers, educators, and bloggers looking to repurpose video

Form Trigger, Google Docs, HTTP Request
Social Media

This workflow is for social media agencies, influencer marketers, and brand managers who need to automatically qualify TikTok creators based on their follower metrics. It’s especially useful for teams

Airtable Trigger, HTTP Request, Airtable
Social Media

Translate cocktail instructions using LingvaNex. Uses manualTrigger, lingvaNex, httpRequest. Event-driven trigger; 3 nodes.

Lingva Nex, HTTP Request