From aab51930d6b2dcbfb60d7b0869036700c553e88e Mon Sep 17 00:00:00 2001 From: nusquama Date: Sat, 22 Nov 2025 10:16:58 +0100 Subject: [PATCH] creation --- ...e_line_google_account_linking_with_oauth2_authentication.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 workflows/Automate LINE & Google Account Linking with OAuth2 Authentication-10950/automate_line_google_account_linking_with_oauth2_authentication.json diff --git a/workflows/Automate LINE & Google Account Linking with OAuth2 Authentication-10950/automate_line_google_account_linking_with_oauth2_authentication.json b/workflows/Automate LINE & Google Account Linking with OAuth2 Authentication-10950/automate_line_google_account_linking_with_oauth2_authentication.json new file mode 100644 index 000000000..34df954b4 --- /dev/null +++ b/workflows/Automate LINE & Google Account Linking with OAuth2 Authentication-10950/automate_line_google_account_linking_with_oauth2_authentication.json @@ -0,0 +1 @@ +{"id":"bBRkNT4Ea1ZqG6gi","meta":{"instanceId":"fb3bf7eea87d58bca5e55c66127bdc3c1ad9d0d6ae5593d428b33051094fd401","templateCredsSetupCompleted":true},"tags":[],"nodes":[{"id":"26a73587-8928-4e52-8dbf-d2268a1ac0c9","name":"Redirect to LINE OA","type":"n8n-nodes-base.respondToWebhook","position":[352,96],"parameters":{"options":{"responseCode":302},"redirectURL":"https://line.me/R/ti/p/@YOUR_LINE_OFFICIAL_ACCOUNT_ID","respondWith":"redirect"},"typeVersion":1.4},{"id":"3e9598b9-66c4-4f00-b6e6-e3eccc103e88","name":"Get Google Access Token","type":"n8n-nodes-base.httpRequest","position":[-320,96],"parameters":{"url":"https://oauth2.googleapis.com/token","method":"POST","options":{},"jsonBody":"={\n \"code\": \"{{ $json.query.code }}\",\n \"client_id\": \"YOUR_GOOGLE_CLIENT_ID\",\n \"client_secret\": \"YOUR_GOOGLE_CLIENT_SECRET\",\n \"redirect_uri\": \"YOUR_N8N_WEBHOOK_URL_FOR_GOOGLE\",\n \"grant_type\": \"authorization_code\"\n}","sendBody":true,"specifyBody":"json"},"typeVersion":4.3},{"id":"29e9c3d9-8fd5-4922-bbe6-bf0f6e6dc589","name":"Get Google User Info","type":"n8n-nodes-base.httpRequest","position":[-96,96],"parameters":{"url":"https://www.googleapis.com/oauth2/v2/userinfo","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"typeVersion":4.3},{"id":"ef6a41c4-f6d4-4a0c-aaeb-2725a6d7fd04","name":"Send Completion Message to LINE","type":"n8n-nodes-base.httpRequest","position":[128,96],"parameters":{"url":"https://api.line.me/v2/bot/message/push","method":"POST","options":{},"jsonBody":"={\n \"to\": \"{{ $('Google Auth Callback').item.json.query.state }}\",\n \"messages\": [\n {\n \"type\": \"text\",\n \"text\": \"Googleアカウントとの連携が完了しました!\\nありがとうございます。\\n\\nアカウント情報\\n{{ $json.email }}\"\n }\n ]\n}","sendBody":true,"specifyBody":"json","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"typeVersion":4.3},{"id":"93f3b1b0-203c-452b-aa54-05671d82f179","name":"If Follow Event","type":"n8n-nodes-base.if","position":[-320,-320],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"1c7b8187-d60b-4601-bd65-a1d9ac35ea8c","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.body.events[0].type }}","rightValue":"follow"}]}},"typeVersion":2.2},{"id":"f00fe94b-9860-45d6-8e82-13f8ea8c4bcf","name":"Create Google Auth URL","type":"n8n-nodes-base.set","position":[-96,-320],"parameters":{"options":{},"assignments":{"assignments":[{"id":"7ccb596a-cf2d-43f8-9e1a-c35a2189e040","name":"googleAuthUrl","type":"string","value":"=https://accounts.google.com/o/oauth2/v2/auth?scope=email%20profile&access_type=offline&response_type=code&state={{ $('LINE Webhook').item.json.body.events[0].source.userId }}&redirect_uri=YOUR_N8N_WEBHOOK_URL_FOR_GOOGLE&client_id=YOUR_GOOGLE_CLIENT_ID"}]}},"typeVersion":3.4},{"id":"9a8ff025-4e28-4cd6-a842-9a032aa97e5c","name":"Send Auth Link to LINE","type":"n8n-nodes-base.httpRequest","position":[128,-320],"parameters":{"url":"https://api.line.me/v2/bot/message/reply","method":"POST","options":{},"jsonBody":"={\n \"replyToken\": \"{{ $('LINE Webhook').item.json.body.events[0].replyToken }}\",\n \"messages\": [\n {\n \"type\": \"text\",\n \"text\": \"友だち追加ありがとうございます!\\nまずはGoogleアカウントと連携して、すべての機能を使えるようにしましょう。\"\n },\n {\n \"type\": \"text\",\n \"text\": \"連携はこちらのリンクからお願いします👇\\n{{ $json.googleAuthUrl }}\"\n }\n ]\n}","sendBody":true,"specifyBody":"json","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"typeVersion":4.3},{"id":"d63e7528-aaae-4c8b-92b9-045ce4bc119e","name":"LINE Webhook","type":"n8n-nodes-base.webhook","position":[-544,-320],"webhookId":"af88d5dc-9207-4dc0-939d-f2472644ce92","parameters":{"path":"YOUR_WEBHOOK_PATH_FOR_LINE","options":{},"httpMethod":"POST"},"typeVersion":2.1},{"id":"91b77beb-10e2-4398-a5c2-3988ee07d192","name":"Google Auth Callback","type":"n8n-nodes-base.webhook","position":[-544,96],"webhookId":"1630c9ed-149a-44f7-ac35-87ac91ee754b","parameters":{"path":"YOUR_WEBHOOK_PATH_FOR_GOOGLE","options":{},"responseMode":"responseNode"},"typeVersion":2.1},{"id":"c78d8f0c-4189-467c-bdb2-7f1a32a4f7ac","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-592,-480],"parameters":{"color":4,"width":1136,"height":336,"content":"### Workflow 1: LINE Follow Event & Authentication Start\n\nThis workflow activates when a user adds your LINE Official Account. It listens for the \"follow\" event, generates a unique Google OAuth2 authentication URL that includes the user's LINE ID, and sends it in a welcome message. This action securely initiates the account linking process for new followers."},"typeVersion":1},{"id":"206575c3-9369-4bc6-bfc8-8778e0ad176d","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-592,-32],"parameters":{"color":5,"width":1136,"height":336,"content":"### Workflow 2: Google Auth Callback & Linking Completion\n\nThis workflow serves as the redirect URI for Google's OAuth2 flow. It receives the authorization code, exchanges it for an access token, and fetches the user's profile. It then sends a confirmation message via LINE and redirects the user's browser, seamlessly completing the account linking process."},"typeVersion":1},{"id":"bb596e53-c8f6-423f-81c4-e58dc16813cc","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-1760,-480],"parameters":{"width":1056,"height":784,"content":"# LINE x Google Account Linking Workflow\n\nThis workflow automates the process of linking a new user on your LINE Official Account to their Google Account. When a user adds your LINE account as a friend, this workflow automatically sends them a message with a unique authentication link. After the user approves the connection, their Google profile information is fetched, and a confirmation message is sent, completing the loop.\n\n### Prerequisites\n\nBefore you begin, ensure you have the following:\n\n* **An n8n instance:** Either on n8n.cloud or a self-hosted environment.\n* **A LINE Developers Account:**\n * A Messaging API channel.\n * Your Channel Access Token (long-lived).\n* **A Google Cloud Platform (GCP) Account:**\n * A configured OAuth consent screen.\n * An OAuth 2.0 Client ID and Client Secret.\n\n### Configuration Overview\n\n1. **In the LINE Developers Console:**\n * Issue and copy your **Channel Access Token**.\n * Set the **Webhook URL** to the URL from the `LINE Webhook` node in n8n.\n\n2. **In the Google Cloud Platform (GCP) Console:**\n * Create **OAuth 2.0 Credentials** to get your **Client ID** and **Client Secret**.\n * Add the URL from the `Google Auth Callback` node as an **Authorized redirect URI**.\n\n3. **In n8n:**\n * Create two **Header Auth** credentials: one for LINE (with your access token) and one for Google (as a dynamic placeholder).\n * Update the placeholder values (`YOUR_GOOGLE_CLIENT_ID`, etc.) in the workflow nodes with your actual credentials.\n * Activate the workflows to go live."},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"1603d558-544b-460a-ab5e-7373891e8b3b","connections":{"LINE Webhook":{"main":[[{"node":"If Follow Event","type":"main","index":0}]]},"If Follow Event":{"main":[[{"node":"Create Google Auth URL","type":"main","index":0}]]},"Get Google User Info":{"main":[[{"node":"Send Completion Message to LINE","type":"main","index":0}]]},"Google Auth Callback":{"main":[[{"node":"Get Google Access Token","type":"main","index":0}]]},"Create Google Auth URL":{"main":[[{"node":"Send Auth Link to LINE","type":"main","index":0}]]},"Send Auth Link to LINE":{"main":[[]]},"Get Google Access Token":{"main":[[{"node":"Get Google User Info","type":"main","index":0}]]},"Send Completion Message to LINE":{"main":[[{"node":"Redirect to LINE OA","type":"main","index":0}]]}}} \ No newline at end of file