'Facebook account linking via Amazon Cognito Userpool

I'm trying to implement account linking with Cognito userpool as the IdP. I'm facing the redirect mismatch error when I click the log in button which redirects to my userpool hosted UI url.

The log in button message I send to the user looks like this:

curl -X POST -H "Content-Type: application/json" -d '{
  "recipient":{
    "id":"<recipient-id>"
  },
  "message":{
    "attachment":{
      "type":"template",
      "payload":{
        "template_type":"button",
        "text":"Try the log in button!",
        "buttons":[
          {
            "type": "account_link",
            "url": "https://<domain>.auth.us-east-1.amazoncognito.com/login?client_id=<client-id>&response_type=code&scope=email+openid"
          }
        ]
      }
    }
  }
}' "https://graph.facebook.com/v2.6/me/messages?access_token=<access-token>"

And in my userpool callback URL I set the value to:

https://facebook.com/messenger_platform/account_linking/

What am I missing here?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source