Skip to content

Commit dce75bb

Browse files
authored
Merge pull request #277 from frittentheke/googInvTokenDetect
fix(Google): update error string to detect invalid oauth token
2 parents 541430a + eb99abb commit dce75bb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/adapter/google/adapter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ func (c *CalendarAPI) Initialize(ctx context.Context, openBrowser bool, config m
153153
// }
154154
_, err = c.gcalClient.ListEvents(ctx, time.Now().Add(-3*time.Hour), time.Now().Add(3*time.Hour))
155155
if err != nil {
156-
if strings.Contains(err.Error(), "Token has been expired") {
157-
c.logger.Info("the refresh token expired, initiating reauthentication...")
156+
if strings.Contains(err.Error(), "invalid_grant") {
157+
c.logger.Info("the refresh token expired or was revoked, initiating reauthentication...")
158158
err := c.storage.RemoveCalendarAuth(c.calendarID)
159159
if err != nil {
160160
return fmt.Errorf("failed to remove authentication for calendar %s: %w", c.calendarID, err)

0 commit comments

Comments
 (0)