8
n8n 中文网amn8n.com

创建 Google 凭据

中级

这是一个Other领域的自动化工作流,包含 7 个节点。主要使用 N8n, Set, SplitOut, ManualTrigger 等节点。 在n8n中自动化Google OAuth2凭据创建

前置要求
  • 无特殊前置要求,导入即可使用

分类

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "fEJliGTxbsE0G8z2",
  "meta": {
    "instanceId": "c7e0ba199938cfb8dab96f39dc136474614055d46336311a365ac15728164ae1",
    "templateCredsSetupCompleted": true
  },
  "name": "创建 Google 凭据",
  "tags": [],
  "nodes": [
    {
      "id": "92174182-12ab-4903-aa1c-d7a872fcadc0",
      "name": "当点击\"测试工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e78da252-0302-42d6-b067-aaeb75f4ee3b",
      "name": "服务",
      "type": "n8n-nodes-base.set",
      "position": [
        600,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "33c46c17-3b0d-43eb-a9c9-3d1b8a71728f",
              "name": "services",
              "type": "array",
              "value": "\n[\n  {\n    \"service\": \"googleDocsOAuth2Api\"\n  },\n  {\n    \"service\": \"googleSheetsOAuth2Api\"\n  },\n  {\n    \"service\": \"googleSlidesOAuth2Api\"\n  },\n  {\n    \"service\": \"googleDriveOAuth2Api\"\n  },\n  {\n    \"service\": \"gmailOAuth2\"\n  },\n  {\n    \"service\": \"googleCalendarOAuth2Api\"\n  },\n  {\n    \"service\": \"googleContactsOAuth2Api\"\n  }\n]"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "1a387d21-b7a0-426b-bacb-6bcd5ec389a7",
      "name": "Google JSON",
      "type": "n8n-nodes-base.set",
      "notes": "Include the entire Google JSON file, which can be obtained either when creating the OAuth 2.0 credentials or afterward from the Credentials page.",
      "position": [
        180,
        0
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "  {\n    \"web\": {\n      \"client_id\": \"\",\n      \"project_id\": \"\",\n      \"auth_uri\": \"\",\n      \"token_uri\": \"\",\n      \"auth_provider_x509_cert_url\": \"\",\n      \"client_secret\": \"\",\n      \"redirect_uris\": [\n        \"\"\n      ]\n    }\n  }"
      },
      "notesInFlow": true,
      "typeVersion": 3.4
    },
    {
      "id": "07096943-ab80-4915-ab59-7e1166303f66",
      "name": "拆分输出",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        820,
        0
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "services"
      },
      "typeVersion": 1
    },
    {
      "id": "a30743a5-f817-43d2-8b9c-df95b8bb2b81",
      "name": "Google 邮箱",
      "type": "n8n-nodes-base.set",
      "notes": "Set to your email address.",
      "position": [
        380,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "18e7a65f-904a-47be-94b6-06c7167c2c62",
              "name": "Google Email",
              "type": "string",
              "value": "username@gmail.com"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 3.4
    },
    {
      "id": "8a24e96a-b3c5-4073-abfc-8177671f7f6c",
      "name": "n8n 创建凭据",
      "type": "n8n-nodes-base.n8n",
      "position": [
        1100,
        0
      ],
      "parameters": {
        "data": "={\n \"clientId\":\"{{ $('Google JSON').item.json.web.client_id }}\",\n \"clientSecret\": \"{{ $('Google JSON').item.json.web.client_secret }}\"\n}",
        "name": "={{ $('Google Email').item.json['Google Email'] }} - {{ $json.service }}",
        "resource": "credential",
        "requestOptions": {},
        "credentialTypeName": "={{ $json.service }}"
      },
      "credentials": {
        "n8nApi": {
          "id": "XMAqFWjBVgTU7khS",
          "name": "n8n account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "55c3814c-e08f-4541-8229-a197fa0fd0ba",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -460,
        -460
      ],
      "parameters": {
        "color": 6,
        "width": 360,
        "height": 520,
        "content": "## 创建 Google 凭据"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "callerPolicy": "workflowsFromSameOwner",
    "executionOrder": "v1",
    "executionTimeout": -1
  },
  "versionId": "8924dfed-07be-4f42-8665-d6f4b1dcbd58",
  "connections": {
    "Services": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "n8n Create Credentials",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google JSON": {
      "main": [
        [
          {
            "node": "Google Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Email": {
      "main": [
        [
          {
            "node": "Services",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Google JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 其他

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量7
分类1
节点类型5
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 查看

分享此工作流