Files
Tempest/server/google-oauth.js

54 lines
1.1 KiB
JavaScript

/**
* 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.
*/
console.log("Setting up Google OAuth...");
try {
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;
}
}
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);
}
/*
ServiceConfiguration.configurations.upsert(
{ service: 'google' },
{
$set: {
clientId: '651343079360-hm5vvji109lphnavft8vej5pp1ruek5q.apps.googleusercontent.com',
loginStyle: 'popup',
secret: 'VAQFr6UBkZ0ZMQJ7tb471BmW'
}
}
);
*/
console.log("Finished OAuth setup.")