feat(google-tasks): add google tasks integration

This commit is contained in:
Rıdvan Akca
2023-12-14 13:55:41 +03:00
parent 953c5a5b5b
commit 7a6aa99840
13 changed files with 255 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
import { URLSearchParams } from 'node:url';
import authScope from '../common/auth-scope.js';
const refreshToken = async ($) => {
const params = new URLSearchParams({
client_id: $.auth.data.clientId,
client_secret: $.auth.data.clientSecret,
grant_type: 'refresh_token',
refresh_token: $.auth.data.refreshToken,
});
const { data } = await $.http.post(
'https://oauth2.googleapis.com/token',
params.toString()
);
await $.auth.set({
accessToken: data.access_token,
expiresIn: data.expires_in,
scope: authScope.join(' '),
tokenType: data.token_type,
});
};
export default refreshToken;