feat: upload service account credentials
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
import { Router } from 'express';;
|
import { Router } from 'express';;
|
||||||
import { google, sheets_v4 } from "googleapis";
|
import { google, sheets_v4 } from "googleapis";
|
||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
export const router = Router()
|
export const router = Router()
|
||||||
|
|
||||||
@@ -9,4 +11,10 @@ router.post('/upload-credentials', (req, res) => {
|
|||||||
|
|
||||||
if (!credentials) {
|
if (!credentials) {
|
||||||
return res.status(400).json({ message: 'Credentials are required.' });
|
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.' });
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user