feat(miro): add miro integration
This commit is contained in:
11
packages/backend/src/apps/miro/common/add-auth-header.ts
Normal file
11
packages/backend/src/apps/miro/common/add-auth-header.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { TBeforeRequest } from '@automatisch/types';
|
||||
|
||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
if ($.auth.data?.accessToken) {
|
||||
requestConfig.headers.Authorization = `${$.auth.data.tokenType} ${$.auth.data.accessToken}`;
|
||||
}
|
||||
|
||||
return requestConfig;
|
||||
};
|
||||
|
||||
export default addAuthHeader;
|
10
packages/backend/src/apps/miro/common/get-current-user.ts
Normal file
10
packages/backend/src/apps/miro/common/get-current-user.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
const getCurrentUser = async ($: IGlobalVariable) => {
|
||||
const { data } = await $.http.get(
|
||||
`https://api.miro.com/v1/oauth-token?access_token=${$.auth.data.accessToken}`
|
||||
);
|
||||
return data.user;
|
||||
};
|
||||
|
||||
export default getCurrentUser;
|
Reference in New Issue
Block a user