From 22e147721178b565999c4c06640c6703460dabc7 Mon Sep 17 00:00:00 2001 From: Leela Senthil Nathan Date: Thu, 28 Aug 2025 16:51:53 -0700 Subject: [PATCH] Use refresh tokens --- package.json | 2 +- src/authentication.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index c3420fc..2d28df4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "linear-zapier", - "version": "4.8.6", + "version": "4.9.0", "description": "Linear's Zapier integration", "main": "index.js", "license": "MIT", diff --git a/src/authentication.ts b/src/authentication.ts index 4837746..cbc35e1 100644 --- a/src/authentication.ts +++ b/src/authentication.ts @@ -81,6 +81,22 @@ export const authentication = { "Content-Type": "application/x-www-form-urlencoded", }, }, + // Zapier will automatically refresh the access token when it expires + refreshAccessToken: { + method: "POST", + url: "https://api.linear.app/oauth/token", + body: { + refresh_token: "{{bundle.authData.refresh_token}}", + client_id: "{{process.env.CLIENT_ID}}", + client_secret: "{{process.env.CLIENT_SECRET}}", + grant_type: "refresh_token", + }, + headers: { + "Content-Type": "application/x-www-form-urlencoded", + }, + }, + // Enable automatic token refresh on 401 errors + autoRefresh: true, scope: "read,write", },