{"id":111872,"date":"2021-03-08T12:33:41","date_gmt":"2021-03-08T07:03:41","guid":{"rendered":"https:\/\/www.vskills.in\/certification\/tutorial\/?page_id=111872"},"modified":"2024-04-12T14:31:38","modified_gmt":"2024-04-12T09:01:38","slug":"data-deletion-request-callback","status":"publish","type":"page","link":"https:\/\/www.vskills.in\/certification\/tutorial\/data-deletion-request-callback\/","title":{"rendered":"Data Deletion Request Callback"},"content":{"rendered":"\n<p>Facebook app settings provides a way for people to request your app to delete the data it has from Facebook about them.<\/p>\n\n\n\n<p>This generates a POST with a signed request that is sent to your app. The signed request contains an app-scoped ID identifying the user making the request. For an example of how to parse the request and the structure of the parsed request, see the following section.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Implementing the Callback<\/h4>\n\n\n\n<p>To parse and respond to the request, you should implement a &#8220;data deletion request&#8221; callback. Your callback must use the secure HTTPS protocol and must be listed in the Data Deletion Request URL field of your app&#8217;s Facebook Login &gt; Settings page in the app dashboard.<\/p>\n\n\n\n<p>If you implement a Data Deletion Request callback, it must do the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Initiate the deletion of any data your app has from Facebook about the user.<\/li><li>Return a JSON response that contains a URL where the user can check the status of their deletion request and an alphanumeric confirmation code. The JSON response has the following form: { url: &#8216;&lt;url&gt;&#8217;, confirmation_code: &#8216;&lt;code&gt;&#8217; }<\/li><\/ul>\n\n\n\n<p>Failure to comply with these requirements may result in your callback being removed or your app being disabled.<\/p>\n\n\n\n<p>You can implement this callback in any language, but the following code is an example of the callback in PHP.<\/p>\n\n\n\n<p>&lt;?php<\/p>\n\n\n\n<p>header(&#8216;Content-Type: application\/json&#8217;);<\/p>\n\n\n\n<p>$signed_request = $_POST[&#8216;signed_request&#8217;];<\/p>\n\n\n\n<p>$data = parse_signed_request($signed_request);<\/p>\n\n\n\n<p>$user_id = $data[&#8216;user_id&#8217;];<\/p>\n\n\n\n<p>\/\/ Start data deletion<\/p>\n\n\n\n<p>$status_url = &#8216;https:\/\/www.&lt;your_website&gt;.com\/deletion?id=abc123&#8217;; \/\/ URL to track the deletion<\/p>\n\n\n\n<p>$confirmation_code = &#8216;abc123&#8217;; \/\/ unique code for the deletion request<\/p>\n\n\n\n<p>$data = array(<\/p>\n\n\n\n<p>&#8216;url&#8217; =&gt; $status_url,<\/p>\n\n\n\n<p>&#8216;confirmation_code&#8217; =&gt; $confirmation_code<\/p>\n\n\n\n<p>);<\/p>\n\n\n\n<p>echo json_encode($data);<\/p>\n\n\n\n<p>function parse_signed_request($signed_request) {<\/p>\n\n\n\n<p>list($encoded_sig, $payload) = explode(&#8216;.&#8217;, $signed_request, 2);<\/p>\n\n\n\n<p>$secret = &#8220;appsecret&#8221;; \/\/ Use your app secret here<\/p>\n\n\n\n<p>\/\/ decode the data<\/p>\n\n\n\n<p>$sig = base64_url_decode($encoded_sig);<\/p>\n\n\n\n<p>$data = json_decode(base64_url_decode($payload), true);<\/p>\n\n\n\n<p>\/\/ confirm the signature<\/p>\n\n\n\n<p>$expected_sig = hash_hmac(&#8216;sha256&#8217;, $payload, $secret, $raw = true);<\/p>\n\n\n\n<p>if ($sig !== $expected_sig) {<\/p>\n\n\n\n<p>error_log(&#8216;Bad Signed JSON signature!&#8217;);<\/p>\n\n\n\n<p>return null;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>return $data;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>function base64_url_decode($input) {<\/p>\n\n\n\n<p>return base64_decode(strtr($input, &#8216;-_&#8217;, &#8216;+\/&#8217;));<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>?&gt;<\/p>\n\n\n\n<p>This produces a JSON object that looks like this, in which user_id is the relevant field for your callback.<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>&#8220;oauth_token&#8221;: &#8220;{user-access-token}&#8221;,<\/p>\n\n\n\n<p>&#8220;algorithm&#8221;: &#8220;HMAC-SHA256&#8221;,<\/p>\n\n\n\n<p>&#8220;expires&#8221;: 1291840400,<\/p>\n\n\n\n<p>&#8220;issued_at&#8221;: 1291836800,<\/p>\n\n\n\n<p>&#8220;user_id&#8221;: &#8220;218471&#8221;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Testing Your Callback<\/h4>\n\n\n\n<p>To test your callback:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Log in to your app with Facebook Login.<\/li><li>Go to app settings: https:\/\/www.facebook.com\/settings?tab=applications<\/li><li>Remove your app.<\/li><li>In the Removed section, click on your app.<\/li><li>Request data deletion from the app card.<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Facebook app settings provides a way for people to request your app to delete the data it has from Facebook about them. This generates a POST with a signed request that is sent to your app. The signed request contains an app-scoped ID identifying the user making the request. For an example of how to&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-111872","page","type-page","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Data Deletion Request Callback - Tutorial<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vskills.in\/certification\/tutorial\/data-deletion-request-callback\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Data Deletion Request Callback - Tutorial\" \/>\n<meta property=\"og:description\" content=\"Facebook app settings provides a way for people to request your app to delete the data it has from Facebook about them. This generates a POST with a signed request that is sent to your app. The signed request contains an app-scoped ID identifying the user making the request. For an example of how to...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vskills.in\/certification\/tutorial\/data-deletion-request-callback\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/vskills.in\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-12T09:01:38+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/data-deletion-request-callback\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/data-deletion-request-callback\/\",\"name\":\"Data Deletion Request Callback - Tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\"},\"datePublished\":\"2021-03-08T07:03:41+00:00\",\"dateModified\":\"2024-04-12T09:01:38+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/data-deletion-request-callback\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vskills.in\/certification\/tutorial\/data-deletion-request-callback\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/data-deletion-request-callback\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Data Deletion Request Callback\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"name\":\"Tutorial\",\"description\":\"Vskills - A initiative in elearning and certification\",\"publisher\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\",\"name\":\"Vskills\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"contentUrl\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"width\":73,\"height\":55,\"caption\":\"Vskills\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/vskills.in\/\",\"https:\/\/x.com\/vskills_in\",\"https:\/\/www.linkedin.com\/company-beta\/1371554\/\",\"https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Data Deletion Request Callback - Tutorial","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vskills.in\/certification\/tutorial\/data-deletion-request-callback\/","og_locale":"en_US","og_type":"article","og_title":"Data Deletion Request Callback - Tutorial","og_description":"Facebook app settings provides a way for people to request your app to delete the data it has from Facebook about them. This generates a POST with a signed request that is sent to your app. The signed request contains an app-scoped ID identifying the user making the request. For an example of how to...","og_url":"https:\/\/www.vskills.in\/certification\/tutorial\/data-deletion-request-callback\/","og_site_name":"Tutorial","article_publisher":"https:\/\/www.facebook.com\/vskills.in\/","article_modified_time":"2024-04-12T09:01:38+00:00","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/data-deletion-request-callback\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/data-deletion-request-callback\/","name":"Data Deletion Request Callback - Tutorial","isPartOf":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website"},"datePublished":"2021-03-08T07:03:41+00:00","dateModified":"2024-04-12T09:01:38+00:00","breadcrumb":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/data-deletion-request-callback\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vskills.in\/certification\/tutorial\/data-deletion-request-callback\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/data-deletion-request-callback\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vskills.in\/certification\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Data Deletion Request Callback"}]},{"@type":"WebSite","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","name":"Tutorial","description":"Vskills - A initiative in elearning and certification","publisher":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization","name":"Vskills","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","contentUrl":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","width":73,"height":55,"caption":"Vskills"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/vskills.in\/","https:\/\/x.com\/vskills_in","https:\/\/www.linkedin.com\/company-beta\/1371554\/","https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw"]}]}},"_links":{"self":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/111872","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/comments?post=111872"}],"version-history":[{"count":1,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/111872\/revisions"}],"predecessor-version":[{"id":111873,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/111872\/revisions\/111873"}],"wp:attachment":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/media?parent=111872"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/categories?post=111872"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/tags?post=111872"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}