sfc-utils 1.4.196 → 1.4.198
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/brands3.js +19 -0
- package/copy/googleauth.js +28 -2
- package/package.json +1 -1
package/brands3.js
CHANGED
|
@@ -226,6 +226,25 @@ let getBrands3 = function (market) {
|
|
|
226
226
|
siteCode: "statesman",
|
|
227
227
|
},
|
|
228
228
|
},
|
|
229
|
+
Dallas: {
|
|
230
|
+
styles: {
|
|
231
|
+
"@brand": "#1665CF",
|
|
232
|
+
"@brand-secondary": "#303030",
|
|
233
|
+
},
|
|
234
|
+
attributes: {
|
|
235
|
+
marketPrefix: "dallasnews",
|
|
236
|
+
siteName: "Dallas Morning News",
|
|
237
|
+
twitter: "dallasnews",
|
|
238
|
+
invert: true,
|
|
239
|
+
// We're faking all this stuff below until Dallas is actually in WCM
|
|
240
|
+
gaAccount: "UA-1616916-99",
|
|
241
|
+
subscribeLink: "https://join.dallasnews.com/",
|
|
242
|
+
sailCustomer: "",
|
|
243
|
+
sailSiteName: "",
|
|
244
|
+
siteId: 101,
|
|
245
|
+
siteCode: "dallasnews",
|
|
246
|
+
},
|
|
247
|
+
},
|
|
229
248
|
/* Misc */
|
|
230
249
|
TK: {
|
|
231
250
|
styles: {
|
package/copy/googleauth.js
CHANGED
|
@@ -46,8 +46,12 @@ var fallbackAuth = function () {
|
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
var authenticate = function ({ fallback }) {
|
|
49
|
+
console.log("\n========== GOOGLEAUTH: authenticate() called ==========");
|
|
50
|
+
console.log("GOOGLEAUTH: fallback parameter =", fallback);
|
|
51
|
+
|
|
49
52
|
if (fallback) {
|
|
50
53
|
return new Promise((resolve, reject) => {
|
|
54
|
+
console.log("GOOGLEAUTH: Using fallback auth path");
|
|
51
55
|
console.log(
|
|
52
56
|
"Service account failed, falling back to regular token (to use the service account, share this sheet or doc with sfchronicle-gatsby@zinc-proton-250521.iam.gserviceaccount.com)"
|
|
53
57
|
);
|
|
@@ -57,14 +61,23 @@ var authenticate = function ({ fallback }) {
|
|
|
57
61
|
// Try to use the service account first
|
|
58
62
|
return new Promise((resolve, reject) => {
|
|
59
63
|
try {
|
|
64
|
+
console.log("GOOGLEAUTH: Attempting service account authentication...");
|
|
65
|
+
|
|
60
66
|
// If it's coming from EC2, pull from project
|
|
61
67
|
if (process.env.GOOGLE_OAUTH_SYSTEM === "EC2") {
|
|
62
68
|
serviceAccountCreds = "../service-account-google-creds.json";
|
|
63
69
|
}
|
|
64
70
|
|
|
71
|
+
console.log("GOOGLEAUTH: Loading credentials from:", serviceAccountCreds);
|
|
72
|
+
|
|
65
73
|
var serviceAccountJSON = fs.readFileSync(serviceAccountCreds, "utf-8");
|
|
66
74
|
serviceAccountJSON = JSON.parse(serviceAccountJSON);
|
|
67
75
|
|
|
76
|
+
console.log(
|
|
77
|
+
"GOOGLEAUTH: Service account email:",
|
|
78
|
+
serviceAccountJSON.client_email
|
|
79
|
+
);
|
|
80
|
+
|
|
68
81
|
// configure a JWT auth client
|
|
69
82
|
let jwtClient = new google.auth.JWT(
|
|
70
83
|
serviceAccountJSON.client_email,
|
|
@@ -75,20 +88,33 @@ var authenticate = function ({ fallback }) {
|
|
|
75
88
|
"https://www.googleapis.com/auth/drive",
|
|
76
89
|
]
|
|
77
90
|
);
|
|
91
|
+
|
|
92
|
+
console.log("GOOGLEAUTH: JWT client created, authorizing...");
|
|
93
|
+
|
|
78
94
|
//authenticate request
|
|
79
95
|
jwtClient.authorize(function (err, tokens) {
|
|
80
96
|
if (err) {
|
|
81
|
-
console.log("Stage 1 error
|
|
97
|
+
console.log("GOOGLEAUTH: Stage 1 error during jwtClient.authorize()");
|
|
98
|
+
console.log("GOOGLEAUTH: Error details:", err.message || err);
|
|
82
99
|
resolve(fallbackAuth());
|
|
83
100
|
} else {
|
|
84
101
|
console.log("Successfully connected to service account!");
|
|
102
|
+
console.log(
|
|
103
|
+
"GOOGLEAUTH: Token type:",
|
|
104
|
+
tokens ? tokens.token_type : "unknown"
|
|
105
|
+
);
|
|
106
|
+
console.log(
|
|
107
|
+
"GOOGLEAUTH: Token expires:",
|
|
108
|
+
tokens ? tokens.expiry_date : "unknown"
|
|
109
|
+
);
|
|
85
110
|
// Return the jwtClient as auth
|
|
86
111
|
resolve(jwtClient);
|
|
87
112
|
}
|
|
88
113
|
});
|
|
89
114
|
} catch (err) {
|
|
90
115
|
// It's ok if it errors, we have the fallback
|
|
91
|
-
console.log("Stage 2 error
|
|
116
|
+
console.log("GOOGLEAUTH: Stage 2 error (catch block)");
|
|
117
|
+
console.log("GOOGLEAUTH: Error details:", err.message || err);
|
|
92
118
|
resolve(fallbackAuth());
|
|
93
119
|
}
|
|
94
120
|
});
|