elk/server/utils
abcb1122 a6e6815b7b fix: auto-recover from OAuth app deletion after token revocation (#2422)
When users revoke OAuth access on their Mastodon server, the OAuth application gets deleted but remains cached in Elk. This causes login failures with 'Client authentication failed due to unknown client'.

This fix adds automatic detection and recovery:
- Detects specific invalid_client errors (401 status)
- Automatically invalidates stale cached OAuth credentials
- Creates fresh OAuth application and retries seamlessly
- Single retry prevents infinite loops
- Preserves existing error handling for other failures

Changes:
- Add invalidateApp() function to server/utils/shared.ts
- Enhanced error handling in server/api/[server]/oauth/[origin].ts
- Backward compatible, zero breaking changes

Fixes #2422
2025-09-18 09:17:03 -05:00
..
shared.ts fix: auto-recover from OAuth app deletion after token revocation (#2422) 2025-09-18 09:17:03 -05:00