feat: Linear OAuth 2.0 (#10851)

Fixes https://linear.app/chatwoot/issue/CW-3417/oauth-20-authentication
We are planning to publish the Chatwoot app in the Linear [integration
list](https://linear.app/docs/integration-directory). While we currently
use token-based authentication, Linear recommends OAuth2 authentication.
This PR implements OAuth2 support.

---------

Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
This commit is contained in:
Muhsin Keloth
2025-02-27 18:15:53 +05:30
committed by GitHub
parent 30996140a3
commit 12134f9391
18 changed files with 432 additions and 29 deletions

View File

@@ -1,10 +1,10 @@
require 'rails_helper'
describe Linear do
let(:api_key) { 'valid_api_key' }
let(:access_token) { 'valid_access_token' }
let(:url) { 'https://api.linear.app/graphql' }
let(:linear_client) { described_class.new(api_key) }
let(:headers) { { 'Content-Type' => 'application/json', 'Authorization' => api_key } }
let(:linear_client) { described_class.new(access_token) }
let(:headers) { { 'Content-Type' => 'application/json', 'Authorization' => "Bearer #{access_token}" } }
it 'raises an exception if the API key is absent' do
expect { described_class.new(nil) }.to raise_error(ArgumentError, 'Missing Credentials')