mirror of
https://github.com/outline/outline.git
synced 2026-11-21 05:24:03 +03:00
* Revert "Add recency boost to search results (#9038)" (#9065)
This reverts commit 2bc47cfcef.
* fix: Double fetch on refactored paginated list (#9068)
* fix: Store Linear workspace logo only when it's available (#9072)
* Extract subdomain auth redirect (#9070)
* Extract subdomain auth redirect
* docs
* Switch Linear to actor=app method (#9074)
* Basic /authorize framework for cloud auth
* Handle logged out OAuth apex
---------
Co-authored-by: Hemachandar <132386067+hmacr@users.noreply.github.com>
54 lines
1.4 KiB
TypeScript
54 lines
1.4 KiB
TypeScript
import queryString from "query-string";
|
|
import env from "@shared/env";
|
|
import { integrationSettingsPath } from "@shared/utils/routeHelpers";
|
|
|
|
export type OAuthState = {
|
|
teamId: string;
|
|
};
|
|
|
|
export class LinearUtils {
|
|
private static oauthScopes = "read,issues:create";
|
|
|
|
public static tokenUrl = "https://api.linear.app/oauth/token";
|
|
public static revokeUrl = "https://api.linear.app/oauth/revoke";
|
|
private static authBaseUrl = "https://linear.app/oauth/authorize";
|
|
|
|
private static settingsUrl = integrationSettingsPath("linear");
|
|
|
|
static parseState(state: string): OAuthState {
|
|
return JSON.parse(state);
|
|
}
|
|
|
|
static successUrl() {
|
|
return this.settingsUrl;
|
|
}
|
|
|
|
static errorUrl(error: string) {
|
|
return `${this.settingsUrl}?error=${error}`;
|
|
}
|
|
|
|
static callbackUrl(
|
|
{ baseUrl, params }: { baseUrl: string; params?: string } = {
|
|
baseUrl: `${env.URL}`,
|
|
params: undefined,
|
|
}
|
|
) {
|
|
return params
|
|
? `${baseUrl}/api/linear.callback?${params}`
|
|
: `${baseUrl}/api/linear.callback`;
|
|
}
|
|
|
|
static authUrl({ state }: { state: OAuthState }) {
|
|
const params = {
|
|
client_id: env.LINEAR_CLIENT_ID,
|
|
redirect_uri: this.callbackUrl(),
|
|
state: JSON.stringify(state),
|
|
scope: this.oauthScopes,
|
|
response_type: "code",
|
|
prompt: "consent",
|
|
actor: "app",
|
|
};
|
|
return `${this.authBaseUrl}?${queryString.stringify(params)}`;
|
|
}
|
|
}
|