Question: How can I set up Application Load Balancer authentication using Facebook and Amazon Cognito as identity providers?

How can I set up Application Load Balancer authentication using Facebook and Amazon Cognito as identity providers (IdPs)?Short descriptionWith Application Load Balancer authentication, the Application Load Balancer either confirms that the client is authenticated or prompts the client to authenticate. The backend target is responsible only for running other business logic or services, such as user profile and payments. The Application Load Balancer is the gatekeeper for denying and allowing client access. However, because Application Load Balancers don't store client login credentials, you can configure Amazon Cognito and Facebook to manage and authenticate users.

ResolutionSet up the Facebook applicationGo to Facebook for developers on the Facebook site.On the top right, choose My Apps, and then choose Add New App.Specify a Display name, and then choose Create App ID.Choose Facebook Login.Choose Web (www).Specify the domain name of the site. This name is the same as the name that you use to alias to the Application Load Balancer's DNS.Choose Next.Skip the JavaScript SDK, and then choose Next.Choose Next.When you get to step 5 in the wizard, continue to set up Amazon Cognito. There's one final step to complete when setting up the Facebook application, but you must set up Amazon Cognito first.Set up the Application Load Balancer for authentication, and then set up Amazon Cognito as an IdP/IdP aggregatorOpen the Amazon Elastic Compute Cloud (Amazon EC2) console.Create an Application Load Balancer.On the navigation pane, under LOAD BALANCING, choose Load Balancers.Select the Application Load Balancer that you created in step 2.Choose Listeners, Add listener.Choose HTTPS:443(or any port with the HTTPS protocol).For Action, choose Authenticate.Keep the Amazon Cognitoselection.For Cognito user pool, choose Create new.For Social IDP, choose Facebook.Go to Facebook for developers on the Facebook site.Select the application that you created in the Set up the Facebook applicationsection of this procedure.Choose Settings, and then choose Basic.Copy the App ID.Choose Show, and then enter your Facebook password to select App Secret.Return to the Amazon Cognito setup page in the Amazon EC2 console. Then, paste the App IDand enter the App Secret.For Authorize scope, enter public_profile.Under Domain prefix, choose a unique name to append to the Amazon Cognito regional DNS service. For example, if you specify "abc" as your domain prefix, your fully qualified domain name (FQDN) is https://abc.auth.us-east-2.amazoncognito.com/.Choose Create Cognito User pool.Copy the domain name you specified in step 18.Add another rule to your HTTPS listener. Choose **Forward to:**and then specify the target group name of your Application Load Balancer.Choose Save.Finish setting up the Facebook applicationOpen the Facebook application.Choose Facebook Login, and then choose Settings.For Valid OAuth Redirect URIs, paste the Amazon Cognito FQDN and add a suffix of /oauth2/idpresponse. For example, https://abc.auth.eu-west-1.amazoncognito.com/oauth2/idpresponse.Choose Save changes.Choose Settings, Basics, App domains.Add the domain name that points to your Application Load Balancer.Choose Save changes.Finish setting up Amazon CognitoOpen the Amazon Cognito console.Choose your configured user pool.Choose App client settings.For Callback URL(s), specify the domain name that you created an alias record for in Route 53 that points to the Application Load Balancer, and then add the /oauth2/idpresponsesuffix. For example, https://www.example.com/oauth2/idpresponse.**Important:**Facebook is a third-party application, which means that the configuration steps above might change over time. For the latest updates, refer to Facebook's documentation on the Facebook site.

Related informationAuthenticate users using an Application Load BalancerSimplify login with Application Load Balancer built-in authenticationFacebook (Identity pools)Register with a social IdP