mirror of
https://github.com/makeplane/plane.git
synced 2026-07-14 14:31:37 +02:00
* fix: oauth redirect urls * fix: silo base path hardcode * fix: transform batch count on job completion * fix: callback uri for asana * fix: build errors --------- Co-authored-by: Saurabhkmr98 <saurabhkapur73@gmail.com> Co-authored-by: Henit Chobisa <chobisa.henit@gmail.com>
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import axios, { AxiosInstance } from "axios";
|
|
import { GithubAuthorizeState } from "@plane/etl/github";
|
|
import { SILO_BASE_PATH } from "@plane/constants";
|
|
|
|
export class IntegrationAuthService {
|
|
protected baseURL: string;
|
|
private axiosInstance: AxiosInstance;
|
|
|
|
constructor(baseURL: string) {
|
|
this.baseURL = baseURL;
|
|
this.axiosInstance = axios.create({ baseURL });
|
|
}
|
|
|
|
/**
|
|
* @description authenticate the github organization
|
|
* @param { GithubAuthorizeState } payload
|
|
* @redirects to the Github authentication URL
|
|
*/
|
|
async githubOrganizationAuthentication(payload: GithubAuthorizeState) {
|
|
return this.axiosInstance
|
|
.post(`${SILO_BASE_PATH}/api/github/auth/url`, payload)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @description authenticate the github personal account
|
|
* @param { GithubAuthorizeState } payload
|
|
* @redirects to the Github authentication URL
|
|
*/
|
|
async githubPersonalAccountAuthentication(payload: GithubAuthorizeState) {
|
|
return this.axiosInstance
|
|
.post(`${SILO_BASE_PATH}/api/github/auth/user/url`, payload)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
}
|