OAuth 2.0 Authentication
How to quickly get a Linear OAuth application set up.
Linear supports OAuth2 authentication, which is recommended if you're building applications to integrate with Linear.
It is highly recommended you create a workspace for the purpose of managing the OAuth2 Application, as each admin user will have access.
1. Create an OAuth2 application in Linear
Create a new OAuth2 Application
Configure the redirect callback URLs to your application
2. Redirect user access requests to Linear
When authorizing a user to the Linear API, redirect to an authorization URL with correct parameters and scopes:
Parameters
Name | Description |
| (required) Client ID provided when you create the OAuth2 Application |
| (required) Redirect URI |
| (required) Expected response type |
| (required) Comma separated list of scopes:
|
| (optional) Prevents CSRF attacks and should always be supplied. Read more about it here |
| (optional) The consent screen is displayed every time, even if all scopes were previously granted. This can be useful if you want to give users the opportunity to connect multiple workspaces. |
| Define how the OAuth application should create issues, comments and other changes:
|
Example
3. Handle the redirect URLs you specified in the OAuth2 Application
Once the user approves your application they will be redirected back to your application, with the OAuth authorization code
in the URL params.
Any state
parameter you specified in step 2 will also be returned in the URL params and must match the value specified in step 2. If the values do not match, the request should not be trusted.
Example
4. Exchange code
for an access token
code
for an access tokenAfter receiving the code
, you can exchange it for a Linear API access token:
Content-Type
header should be application/x-www-form-urlencoded
Parameters
Name | Description |
| (required) Authorization code from the previous step |
| (required) Same redirect URI which you used in the previous step |
| (required) Application's client ID |
| (required) Application's client secret |
| (required) |
Response
After a successful request, a valid access token will be returned in the response:
Note: OAuth apps created prior to Dec 1, 2023 will instead return scope
as an array of strings in the token response.
5. Make an API request
Once you have obtained a valid access token, you can make a request to Linear's GraphQL API.
You can initialize the Linear Client with the access token:
Or pass the token as an authorization header: Authorization: Bearer <ACCESS_TOKEN>
6. Revoke an access token
To revoke a user's access to your application pass the access token as Bearer token in the authorization header (Authorization: Bearer <ACCESS_TOKEN>
) or as the access_token
form field:
Response
Expected HTTP status:
200
- token was revoked400
- unable to revoke token (e.g. token was already revoked)401
- unable to authenticate with the token
Last updated