Cognito User Pools - Is it possible to create a custom sign up/in form for Facebook login?

So here is what I understand from your query.

Setup

  • Link Facebook to userpool
  • The app client allows only Facebook login, no other providers allowed (not even Userpool)
  • On login, you want Facebook user's info to be automatically populated in your Userpool
  • You don't want to use Cognito's builtin UI but use your own

My 2 Cents

  • In your app client, just select Facebook
  • In your UI, have a login button. On clicking it should redirect to your userpool's authorization endpoint

    https://your_domain.auth.us-east-1.amazoncognito.com/oauth2/authorize?redirect_uri=https://www.example.com&response_type=token&client_id=your_appclient_id

  • If you want to use your own UI with multiple providers, allow the same in Client and on clicking the appropriate button in your UI (say Facebook), redirect users to the authorize endpoint but append the identity_provider in the URL

    https://your_domain.auth.us-east-1.amazoncognito.com/oauth2/authorize?redirect_uri=https://www.example.com&response_type=token&client_id=your_appclient_id&identity_provider=Facebook

  • If you want to see the names of all supported identity providers, use ListIdentityProviders API call

This way, all Facebook users will be automatically created in your userpool. Of course, their names will be random like Facebook_123jkjdwj but all their details will be correctly populated from the token as per your attribute mapping. As a plus, all auto-created users from a particular provider are added to an auto-created group 'Userpoolid_providername' eg. us_east_1_xxxx_Facebook.