Implementation for the Data Deletion Callback in JavaScript for Node with Expressjs.
The most stupid pitfall for this callback is that the response has to look like this:
{ url: '<url>', confirmation_code: '<code>' }
This and other more reasonable variations are invalid:
{ "url": "<url>", "confirmation_code": "<code>" }
This means you cannot use JSON.stringify
or Response.json(object)
, but this glorious snippet:
res.type('json')
res.send(`{ url: '${url}', confirmation_code: '${confirmationCode}' }`)
Another pitfall is that Facebook's signature always has a =
appended (see line 43 in parseSignedRequest.mjs).
Basically, it tries to find
signed_request
within the body and returns it. If the key is missing, clients get the response code 400. Here is the implementation: