MCPcopy Create free account
hub / github.com/Noumena-Network/code / isTerminalOAuthRefreshFailure

Function isTerminalOAuthRefreshFailure

src/utils/auth.ts:1558–1574  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

1556}
1557
1558function isTerminalOAuthRefreshFailure(error: unknown): boolean {
1559 const oauthErrorCode = getOAuthErrorCode(error)
1560 if (oauthErrorCode) {
1561 return (
1562 oauthErrorCode === 'refresh_token_invalidated' ||
1563 oauthErrorCode === 'invalid_grant'
1564 )
1565 }
1566
1567 const message = errorMessage(error).toLowerCase()
1568 return (
1569 message.includes('refresh_token_invalidated') ||
1570 message.includes('invalid_grant') ||
1571 message.includes('token revoked') ||
1572 message.includes('oauth token has been revoked')
1573 )
1574}
1575
1576function getOAuthErrorCode(error: unknown): string | null {
1577 if (!error || typeof error !== 'object' || !('response' in error)) {

Callers 1

Calls 2

getOAuthErrorCodeFunction · 0.85
errorMessageFunction · 0.70

Tested by

no test coverage detected