feat: upload service account credentials

This commit is contained in:
karishmas6
2024-09-17 20:39:42 +05:30
parent fcd1160441
commit 84a4afa7fc

View File

@@ -1,5 +1,7 @@
import { Router } from 'express';;
import { google, sheets_v4 } from "googleapis";
import fs from 'fs';
import path from 'path';
export const router = Router()
@@ -9,4 +11,10 @@ router.post('/upload-credentials', (req, res) => {
if (!credentials) {
return res.status(400).json({ message: 'Credentials are required.' });
}
}
// Todo: Store the credentials in a secure place (for test, we store them locally)
const storedCredentialsPath = path.join(__dirname, 'service_account_credentials.json');
fs.writeFileSync(storedCredentialsPath, JSON.stringify(credentials));
res.status(200).json({ message: 'Service Account credentials saved successfully.' });
});