Problem Statement
apps/backend/src/routes/connect.ts defines a GITHUB_FOLLOW_PLATFORM constant with value 'github_follow' for the OAuth token that carries the user:follow scope. However, the DELETE /api/connect/:platform endpoint only accepts platforms in a hardcoded allowlist that does not include 'github_follow':
const SUPPORTED_PLATFORMS = ['github', 'google', 'twitter', 'linkedin'];
if (!SUPPORTED_PLATFORMS.includes(platform)) {
return reply.status(400).send({ error: `Unsupported platform: ${platform}` });
}
GITHUB_FOLLOW_PLATFORM = 'github_follow' is never in this list, so there is no way to delete the follow-capable token through the API. When a user disconnects GitHub from the settings page, only their 'github' read-only token is removed. The 'github_follow' token with user:follow scope remains permanently in the OAuthToken table.
Steps to Reproduce
- Connect a GitHub account through Settings (triggers
GET /api/connect/github).
- After callback, the
OAuthToken table contains a row with platform = 'github_follow'.
- Call
DELETE /api/connect/github_follow with a valid JWT.
- Receive
400 Bad Request: "Unsupported platform: github_follow".
- Inspect the database - the
github_follow token still exists.
- Disconnecting via
DELETE /api/connect/github removes only the 'github' login token and leaves 'github_follow' untouched.
Expected Behavior
A user who disconnects their GitHub account should have all associated OAuth tokens removed, including the 'github_follow' credential. At minimum, 'github_follow' should be deletable as a supported platform.
Actual Behavior
The 'github_follow' token cannot be deleted via the disconnect endpoint. It persists in the database indefinitely, granting unused user:follow access to the stored GitHub account even after the user believes they have fully disconnected.
Root Cause Analysis
The SUPPORTED_PLATFORMS list was created before GITHUB_FOLLOW_PLATFORM was introduced as a separate token to avoid overwrite collisions between the login flow and the follow-connect flow. The list was never updated to include 'github_follow'.
Suggested Fix
Two options:
Option A - Add 'github_follow' to SUPPORTED_PLATFORMS:
const SUPPORTED_PLATFORMS = ['github', 'google', 'twitter', 'linkedin', 'github_follow'];
Option B - When deleting 'github', also delete 'github_follow' in the same transaction:
if (platform === 'github') {
await app.prisma.oAuthToken.deleteMany({
where: { userId, platform: { in: ['github', GITHUB_FOLLOW_PLATFORM] } },
});
} else {
await app.prisma.oAuthToken.delete({ where: { userId_platform: { userId, platform } } });
}
Option B is more user-friendly since users see a single "GitHub" connection in the UI and expect one disconnect to remove all GitHub tokens.
Environment
- File:
apps/backend/src/routes/connect.ts
- Constant:
GITHUB_FOLLOW_PLATFORM = 'github_follow' (line 16)
- Endpoint:
DELETE /api/connect/:platform
- Affected field:
SUPPORTED_PLATFORMS array
Checklist
Problem Statement
apps/backend/src/routes/connect.tsdefines aGITHUB_FOLLOW_PLATFORMconstant with value'github_follow'for the OAuth token that carries theuser:followscope. However, theDELETE /api/connect/:platformendpoint only accepts platforms in a hardcoded allowlist that does not include'github_follow':GITHUB_FOLLOW_PLATFORM = 'github_follow'is never in this list, so there is no way to delete the follow-capable token through the API. When a user disconnects GitHub from the settings page, only their'github'read-only token is removed. The'github_follow'token withuser:followscope remains permanently in theOAuthTokentable.Steps to Reproduce
GET /api/connect/github).OAuthTokentable contains a row withplatform = 'github_follow'.DELETE /api/connect/github_followwith a valid JWT.400 Bad Request: "Unsupported platform: github_follow".github_followtoken still exists.DELETE /api/connect/githubremoves only the'github'login token and leaves'github_follow'untouched.Expected Behavior
A user who disconnects their GitHub account should have all associated OAuth tokens removed, including the
'github_follow'credential. At minimum,'github_follow'should be deletable as a supported platform.Actual Behavior
The
'github_follow'token cannot be deleted via the disconnect endpoint. It persists in the database indefinitely, granting unuseduser:followaccess to the stored GitHub account even after the user believes they have fully disconnected.Root Cause Analysis
The
SUPPORTED_PLATFORMSlist was created beforeGITHUB_FOLLOW_PLATFORMwas introduced as a separate token to avoid overwrite collisions between the login flow and the follow-connect flow. The list was never updated to include'github_follow'.Suggested Fix
Two options:
Option A - Add
'github_follow'toSUPPORTED_PLATFORMS:Option B - When deleting
'github', also delete'github_follow'in the same transaction:Option B is more user-friendly since users see a single "GitHub" connection in the UI and expect one disconnect to remove all GitHub tokens.
Environment
apps/backend/src/routes/connect.tsGITHUB_FOLLOW_PLATFORM = 'github_follow'(line 16)DELETE /api/connect/:platformSUPPORTED_PLATFORMSarrayChecklist