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: 2 additions & 0 deletions apps/sim/lib/oauth/__tests__/terminal-errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ describe('isTerminalRefreshError', () => {
'invalid_client_id',
'invalid_client',
'bad_redirect_uri',
'token_revoked',
'unauthorized_client',
])('returns true for %s', (code) => {
expect(isTerminalRefreshError(code)).toBe(true)
})
Expand Down
7 changes: 7 additions & 0 deletions apps/sim/lib/oauth/terminal-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import { getRedisClient } from '@/lib/core/config/redis'

const logger = createLogger('OAuthTerminalErrors')

/**
* Refresh error codes that no retry can recover from: the credential stays dead until
* its owner reconnects. `unauthorized_client` is how Atlassian rejects a revoked or
* rotated-out refresh token, and under RFC 6749 section 5.2 it otherwise means the
* client may not use the refresh grant, which is equally persistent.
*/
const TERMINAL_ERRORS = new Set<string>([
'invalid_refresh_token',
'bad_refresh_token',
Expand All @@ -14,6 +20,7 @@ const TERMINAL_ERRORS = new Set<string>([
'invalid_client',
'bad_redirect_uri',
'token_revoked',
'unauthorized_client',
])

const DEAD_CACHE_TTL_SEC = 60 * 60
Expand Down
Loading