2021-09-16 07:26:57 -07:00
|
|
|
/**
|
|
|
|
|
* Google cloud platform: https://console.developers.google.com/apis/dashboard
|
|
|
|
|
* Setup a OAuth consent screen, then setup OAuth credentials.
|
|
|
|
|
* Loads the information from the /private/settings.json file.
|
|
|
|
|
*/
|
|
|
|
|
|
2022-08-15 07:01:20 -07:00
|
|
|
console.log("Setting up Google OAuth...");
|
|
|
|
|
|
2021-09-16 07:26:57 -07:00
|
|
|
try {
|
2022-03-09 07:55:26 -08:00
|
|
|
let settings = Assets.getText('settings.json');
|
|
|
|
|
|
|
|
|
|
if(settings) {
|
|
|
|
|
try {
|
|
|
|
|
settings = JSON.parse(settings);
|
|
|
|
|
}
|
|
|
|
|
catch(err) {
|
|
|
|
|
console.error("Failed to load the /private/settings.json file as a JSON object.");
|
|
|
|
|
console.error(err);
|
|
|
|
|
settings = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-09-16 07:26:57 -07:00
|
|
|
|
|
|
|
|
if (settings) {
|
|
|
|
|
ServiceConfiguration.configurations.upsert({
|
|
|
|
|
service: "google"
|
|
|
|
|
}, {
|
|
|
|
|
$set: {
|
|
|
|
|
loginStyle: settings.google.loginStyle,
|
|
|
|
|
clientId: settings.google.clientId,
|
|
|
|
|
secret: settings.google.secret
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
console.log("Error: No settings file.");
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.log(err);
|
2022-03-09 07:55:26 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
ServiceConfiguration.configurations.upsert(
|
|
|
|
|
{ service: 'google' },
|
|
|
|
|
{
|
|
|
|
|
$set: {
|
|
|
|
|
clientId: '651343079360-hm5vvji109lphnavft8vej5pp1ruek5q.apps.googleusercontent.com',
|
|
|
|
|
loginStyle: 'popup',
|
|
|
|
|
secret: 'VAQFr6UBkZ0ZMQJ7tb471BmW'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
*/
|
2022-08-15 07:01:20 -07:00
|
|
|
|
|
|
|
|
console.log("Finished OAuth setup.")
|