{"record":{"id":"a8ffa29dd6bc09f2","repo":"yikart/AiToEarn","slug":"channelauthaccountaccessrevoked","errorCode":"ChannelAuthAccountAccessRevoked","errorMessage":"ChannelAuthAccountAccessRevoked","messagePattern":"ChannelAuthAccountAccessRevoked","errorType":"error_code","errorClass":"AppException","httpStatus":null,"severity":"error","filePath":"project/aitoearn-backend/apps/aitoearn-server/src/core/channels/platforms/facebook/facebook-auth.provider.ts","lineNumber":104,"sourceCode":"          tasks: page.tasks,\n          category: page.category,\n          categoryList: page.category_list,\n          fansCount: page.followers_count ?? page.fan_count,\n          fanCount: page.fan_count,\n          followersCount: page.followers_count,\n        },\n      })\n    }\n\n    return accounts\n  }\n\n  async refreshAccountAccess(input: RefreshAccountAccessInput): Promise<PlatformSelectableAccount> {\n    const pages = await this.facebookService.listPages(input.rootAccessToken)\n    const page = pages.find(p => p.id === input.platformUid)\n\n    if (!page) {\n      throw new AppException(ResponseCode.ChannelAuthAccountAccessRevoked)\n    }\n\n    return {\n      platform: AccountType.Facebook,\n      platformUid: page.id,\n      displayName: page.name,\n      avatarUrl: page.picture?.data?.url,\n      fansCount: page.followers_count ?? page.fan_count,\n      credential: {\n        accessToken: page.access_token,\n        refreshToken: input.rootRefreshToken,\n      },\n      profile: {\n        tasks: page.tasks,\n        category: page.category,\n        categoryList: page.category_list,\n        fansCount: page.followers_count ?? page.fan_count,\n        fanCount: page.fan_count,","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/yikart/AiToEarn/blob/d3aa8bea5b146a8675607cf0144d891aad3e9683/project/aitoearn-backend/apps/aitoearn-server/src/core/channels/platforms/facebook/facebook-auth.provider.ts#L86-L122","documentation":"Facebook page lookup failed during account access refresh: the list of pages accessible by the root access token does not contain a page matching the stored platformUid. This means the app/token no longer has access to that specific Facebook Page, so the channel is treated as revoked.","triggerScenarios":"refreshAccountAccess is called with a rootAccessToken whose /me/accounts (listPages) response no longer includes the page with id === input.platformUid.","commonSituations":"Page admin removed the app or revoked the integration; the user lost admin/editor role on the Page; token was issued for a different Business/Page scope; page was deleted or merged.","solutions":["Re-authenticate the Facebook channel so a fresh token with Page access is obtained","Verify the user still has a role on the target Page and that the app is still installed on it","Check that input.platformUid matches the page id stored at auth time (no id remap/merge)","Confirm the token was requested with pages_show_list / pages_manage_metadata scopes"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before calling refreshAccountAccess, verify the page is still listed\nconst pages = await facebookService.listPages(rootAccessToken)\nif (!pages.some(p => p.id === platformUid)) {\n  throw new Error('Facebook page no longer accessible; re-auth required')\n}","typeGuard":"function hasPageAccess(pages: { id: string }[], platformUid: string): boolean {\n  return pages.some(p => p.id === platformUid)\n}","tryCatchPattern":"try {\n  await provider.refreshAccountAccess({ rootAccessToken, platformUid })\n} catch (e) {\n  if (e.code === 'ChannelAuthAccountAccessRevoked') {\n    await markChannelRevoked(accountId)\n    notifyUserToReconnect('facebook')\n  } else throw e\n}","preventionTips":["Periodically probe /me/accounts and flag channels whose page disappears","Store the page name/id at auth time and compare on refresh","Alert users before token/page access expires","Handle page merges by re-matching platformUid via stored page names"],"tags":["facebook","oauth","auth-revoked","pages"],"backgroundTag":"oauth-access-revoked","analyzedSha":"d3aa8bea5b146a8675607cf0144d891aad3e9683","analyzedAt":"2026-08-31T14:19:24.185Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}