Skip to content

Commit 3b232a7

Browse files
committed
Fixed display HTML and authentication for custom token path
1 parent b67994c commit 3b232a7

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

authenticate.mjs

+10-7
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fs.readFile(options.credentialFile, (err, content) => {
3737
rl.close();
3838
console.log(`You chose ${code}`);
3939
// Authorize a client with credentials, then call the Google Slides API.
40-
authorize(JSON.parse(content), currentTokens, code, listTaskLists);
40+
authorize(options.tokenFile, JSON.parse(content), currentTokens, code, listTaskLists);
4141
});
4242

4343

@@ -49,7 +49,7 @@ fs.readFile(options.credentialFile, (err, content) => {
4949
* @param {Object} credentials The authorization client credentials.
5050
* @param {function} callback The callback to call with the authorized client.
5151
*/
52-
function authorize(credentials, currentTokens, account, callback) {
52+
function authorize(tokenPath, credentials, currentTokens, account, callback) {
5353
const {client_secret, client_id, redirect_uris} = credentials.installed;
5454
const oAuth2Client = new google.auth.OAuth2(
5555
client_id, client_secret, redirect_uris[0]);
@@ -58,7 +58,7 @@ function authorize(credentials, currentTokens, account, callback) {
5858

5959
if (!existingToken)
6060
{
61-
getNewToken(oAuth2Client, currentTokens, account, callback);
61+
getNewToken(tokenPath, oAuth2Client, currentTokens, account, callback);
6262
}
6363
else
6464
{
@@ -73,7 +73,7 @@ function authorize(credentials, currentTokens, account, callback) {
7373
* @param {google.auth.OAuth2} oAuth2Client The OAuth2 client to get token for.
7474
* @param {getEventsCallback} callback The callback for the authorized client.
7575
*/
76-
function getNewToken(oAuth2Client, currentTokens, account, callback) {
76+
function getNewToken(tokenPath, oAuth2Client, currentTokens, account, callback) {
7777
const authUrl = oAuth2Client.generateAuthUrl({
7878
access_type: 'offline',
7979
scope: SCOPES,
@@ -89,7 +89,10 @@ function getNewToken(oAuth2Client, currentTokens, account, callback) {
8989
rl.question('Enter the code from that page here: ', (code) => {
9090
rl.close();
9191
oAuth2Client.getToken(code, (err, token) => {
92-
if (err) return callback(err);
92+
if (err) {
93+
console.log("Error: " + err);
94+
return callback(err);
95+
}
9396
oAuth2Client.setCredentials(token);
9497

9598
if (existingToken) {
@@ -103,9 +106,9 @@ function getNewToken(oAuth2Client, currentTokens, account, callback) {
103106
}
104107

105108
// Store the token to disk for later program executions
106-
fs.writeFile(TOKEN_PATH, JSON.stringify(currentTokens), (err) => {
109+
fs.writeFile(tokenPath, JSON.stringify(currentTokens), (err) => {
107110
if (err) console.error(err);
108-
console.log('Token stored to', TOKEN_PATH);
111+
console.log('Token stored to', tokenPath);
109112
});
110113
callback(oAuth2Client);
111114
});

src/frontend/Display.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const getItemView = (item: Task, config: AppearanceConfig): HTMLElement => {
8282
const itemWrapper = document.createElement("li");
8383
itemWrapper.className = "item";
8484

85-
const titleWrapper = document.createElement("li");
85+
const titleWrapper = document.createElement("span");
8686

8787
titleWrapper.innerText = item.title;
8888
titleWrapper.className = "title";

0 commit comments

Comments
 (0)