Repository navigation
Add Meta data deletion callbacks, Google revoke on removal and LinkedIn Page refresh - #520
Open
mainalisandeep062 wants to merge 2 commits into
Open
mainalisandeep062 wants to merge 2 commits into
mainalisandeep062 wants to merge 2 commits into
Conversation
…In Page refresh Self-hosted installs run their own Meta, Google and LinkedIn apps, and each network asks for compliance endpoints before an app can go Live or pass review. Meta: each app (Facebook, Instagram, Threads) gets a Deauthorize and a Data Deletion callback on WEBHOOK_URL, verified with that app's secret and run without the web middleware. Deauthorize flags the user's channels for reconnection and emails each workspace owner once. Data Deletion answers with a status page URL and confirmation code, and an encrypted job removes the user's own Instagram and Threads channels like Disconnect does, while Facebook Pages (and Instagram through a Page) keep their posts and lose the admin's id and tokens. Instagram through Facebook now stores the Facebook user it came from. Disconnect moves into the DisconnectSocialAccount action. Google: removing a YouTube or Google Business channel queues an encrypted revoke, skipped while another channel still holds the same Google user's grant, since revoking ends the whole grant. LinkedIn: a daily command re-reads LinkedIn Page names and logos after 7 weeks and clears them at 8 weeks when they can no longer be read, per LinkedIn's data storage requirements. Member profiles are left alone. The organization lookup moves into LinkedInOrganizations. Closes trypostit#519.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
mainalisandeep062
added a commit
to yoddha-social/socialhq
that referenced
this pull request
Nov 19, 2026
…In Page refresh (#42) The platform compliance pack, also proposed to TryPost as [trypostit#520](trypostit#520) (issue trypostit#519). This branch carries the same commit, cherry-picked, so we have it now. The full design is in trypostit#520's description. ## What it adds **Meta.** The Facebook, Instagram and Threads apps each get a Deauthorize URL and a Data Deletion URL on `WEBHOOK_URL`: - `/meta/{facebook,instagram,threads}/deauthorize` - `/meta/{facebook,instagram,threads}/data-deletion` Each callback is verified with that app's secret and runs with no session or CSRF. - **Deauthorize:** flags the person's channels for reconnection, with one email per workspace. - **Data Deletion:** - Removes the person's own Instagram and Threads channels with their posts. - Facebook Pages, and Instagram connected through a Page, keep their posts. They lose the person's id and tokens and need reconnecting. - Meta gets a status page URL and a confirmation code. Paste these URLs into the Meta app's settings; `.env.example` lists them. Meta wants a data deletion URL before an app can go Live. **Google.** Removing a YouTube or Google Business channel revokes its grant. The revoke is skipped while another channel uses the same Google user, because revoking ends the whole grant. **LinkedIn.** A daily `social:refresh-linkedin-pages` re-reads Page names and logos after 7 weeks. It clears them at 8 weeks when they can no longer be read, which is LinkedIn's storage limit for organization data. ## Fork notes - **PATCHES.md row 220** lists every TryPost file touched. Remove it when trypostit#520 is merged and comes in with an intake. - **Indonesian copy dropped.** TryPost's `lang/id` isn't in the fork, so the new strings' `lang/id` copy is left out. - **Conflicts.** No other PR is open, so rows 220+ are free. - **Deploy:** - Run the migrations (`data_deletion_requests`, and `social_accounts.profile_refreshed_at`). - The scheduler picks up the new daily command. - On the Meta app, set the two callback URLs (`publish.<domain>` must reach `/meta/...` without Cloudflare Access in front, since Meta can't sign in). ## Tests Run locally on PostgreSQL in the Docker runner: - `tests/Feature/Social` with the new tests: 563 passed - `tests/Feature/SocialHq`: 609 passed - Channels, SocialAccount, Observers, Models, LocalizationParity, Console and Commands: 412 passed - `tests/Unit`: 2022 passed, 11 skipped Not run here: - **Browser tests:** the new page has no browser test. - **MySQL.** - **Full `vue-tsc`:** the worktree had no Wayfinder output. The new page itself has no type errors, and Prettier and ESLint are clean on it.
Contributor
|
That's good @mainalisandeep062 i will check it soon! |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #519.
Self-hosted installs run their own Meta, Google and LinkedIn apps, and each of these networks asks for something TryPost didn't have before an app can go Live or pass review. This PR adds all three parts of #519 together.
Meta: Deauthorize and Data Deletion callbacks
Each Meta app (Facebook, Instagram, Threads) has its own secret and its own callback fields, so each gets its own URLs on
WEBHOOK_URL:/meta/{facebook,instagram,threads}/deauthorize/meta/{facebook,instagram,threads}/data-deletion.env.examplelists them next to each app's keys.Verification.
SignedRequestverifies thesigned_requestwith that app's secret: HMAC-SHA256 over the base64url payload, compared withhash_equals. The algorithm must beHMAC-SHA256. An empty secret or a malformed or unsigned request gets a 403.Session. The two POST routes run
withoutMiddleware('web'), like/.well-known, so Meta's server-to-server calls start no session and need no CSRF token.Matching a callback to channels (
SocialAccount::scopeAuthorizedByMetaUser):meta.user_idon Facebook Page channels and on Instagram-through-Facebook channels. The Instagram-through-Facebook connect now stores the Facebook user it came from.platform_user_id(Instagram Login's app-scoped id), ormeta.ig_user_id. Meta's docs don't say which of the two the callback carries.platform_user_id.Deauthorize. The matched channels are flagged
token_expired, and each workspace owner gets oneWorkspaceConnectionsDisconnectedemail listing them, as the daily check sends. There is no email per channel.Data Deletion. The callback opens a
data_deletion_requestsrow and answers with{ url, confirmation_code }. The row holds the app, the code, a status and a count, and nothing that identifies the person. An encrypted queued job,DeleteMetaUserData, does the work:DisconnectSocialAccountaction, whichSocialController@disconnectnow calls too.meta.user_id,meta.user_token) and the tokens their login gave are erased, the channel is flagged for reconnection, and the owner is emailed as above. If you'd rather remove these channels too, it's a one-line change.Status page.
GET /meta/data-deletion/{code}(meta/DataDeletionStatus, on the auth layout) says whether the request is done. Its copy is in all 17lang/*/accounts.phpfiles.Google: revoke on removal
When a YouTube or Google Business channel is removed (Disconnect, or a data deletion),
SocialAccountObserver::deletedqueuesRevokeGoogleGrantafter the commit. It is encrypted, because it carries the refresh token, and posts to{oauth_api}/revoke.Google's docs say a revocation removes every scope the user granted to the project, for all of its clients. So the job skips the revoke while any other YouTube or Google Business channel, in any workspace, still has the same
meta.google_user_id: other channels of the same login, or a location connected in another workspace. Without agoogle_user_idthere's no way to tell, so nothing is revoked.A 400 (already revoked or expired) counts as done. 5xx, 429 and connection errors are retried 3 times. A failed revoke never brings the channel back.
LinkedIn: Page profile storage
LinkedIn's Data Storage Requirements allow 8 weeks for the profile data of an organization that authenticated into the app.
social:refresh-linkedin-pages, re-reads the name, vanity name and logo of each LinkedIn Page channel 7 weeks after it was last read. The newsocial_accounts.profile_refreshed_atcolumn is set on every connect.LinkedInControllertoLinkedInOrganizations, so connect and refresh use the same request.Not in this PR (worth a follow-up)
meta.user_id, so the Facebook callbacks can't match them until they're reconnected. The daily check still catches their dead tokens.issued_atisn't checked, because Meta documents no window.Tests
tests/Feature/Social/MetaCallbacksTest.phpcovers:tests/Feature/Jobs/RevokeGoogleGrantTest.phpcovers:google_user_id;tests/Feature/Actions/SocialAccount/RefreshLinkedInPageProfileTest.phpcovers:InstagramFacebookControllerTestasserts the storeduser_id.tests/Pest.phpfakesRevokeGoogleGrantnext toBootstrapAccountAnalytics, so tests that remove Google channels never call Google.Run on PostgreSQL: the new tests, plus
tests/Feature/{Social,Channels,SocialAccount,Observers,Models,Jobs,Console,Commands,Actions,Mail},LocalizationParityTestandtests/Unit. MySQL was not run locally. Themeta->...lookups go through Laravel's JSON grammar.I verified the signed-request format against Meta's Data Deletion Callback docs. Meta doesn't document the Instagram and Threads payloads separately, so I haven't checked them against a live app yet.
🤖 Generated with Claude Code