Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
adding error catching for invalid refresh tokens
Browse files Browse the repository at this point in the history
Note: This commit should have existed a long time ago
  • Loading branch information
DerLev committed Aug 8, 2022
1 parent 9fc456c commit 933421e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,17 @@ oAuth2Client.setCredentials({

// Initializing calendar object with OAuth2 client
const calendar = google.calendar({ version: 'v3', auth: oAuth2Client })
calendar.calendarList.list(
{},
(err) => {
if (err) {
log(0, "The refresh token is invalid!")
// @ts-ignore
log(3, err.response.data ? err.response.data : err)
process.exit(1)
}
}
)

// Initializing Notion application with set token
const notion = new Client({ auth: process.env.NOTION_TOKEN })
Expand Down

0 comments on commit 933421e

Please sign in to comment.