Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/services/OAuth2TokenRefreshService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class OAuth2TokenRefreshService {
const { oauth2 } = config;
const now = Date.now();

if (oauth2.accessTokenExpiry - now > EXPIRY_BUFFER_MS) {
if (!oauth2.accessTokenExpiry || !oauth2.refreshToken || oauth2.accessTokenExpiry - now > EXPIRY_BUFFER_MS) {
return;
}

Expand Down
6 changes: 3 additions & 3 deletions src/services/providers/channel/SmtpImapChannelProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ const oauth2ConfigSchema = z.strictObject({
tokenUrl: z.string().url().describe('OAuth2 token endpoint URL (e.g. https://oauth2.googleapis.com/token for Gmail)'),
clientId: z.string().describe('OAuth2 client ID'),
clientSecret: z.string().describe('OAuth2 client secret'),
refreshToken: z.string().describe('OAuth2 refresh token (long-lived)'),
accessToken: z.string().describe('Current OAuth2 access token (rotated by the refresh service)'),
accessTokenExpiry: z.number().int().describe('Unix timestamp in milliseconds when the access token expires'),
refreshToken: z.string().optional().describe('OAuth2 refresh token (long-lived, managed by the OAuth2 callback/refresh service)'),
accessToken: z.string().optional().describe('Current OAuth2 access token (managed by the OAuth2 callback/refresh service)'),
accessTokenExpiry: z.number().int().optional().describe('Unix timestamp in milliseconds when the access token expires (managed by the OAuth2 callback/refresh service)'),
scope: z.string().describe('OAuth2 scope string (e.g. https://www.googleapis.com/auth/gmail.modify for Gmail)'),
}).openapi('SmtpImapOauth2Config');

Expand Down
Loading