1

I'm trying to develop a React application that will allow users to login with their Azure AD accounts and their Facebook accounts.

The first thing is that I didn't understand about the 2 tabs "User Pools and Federation Identities". Do I need both to get it done or just the User Pools is enough?

My goal is just the authentications. I don't want to allow users to access any AWS service. I just want the authentication token.

I already got the user logged in via facebook using the Federation Identities and the Facebook SDK, but I don't know how to keep the user data saved after getting the token from facebook auth. Also is it correct to use the facebook SDK or should I use Cognito to take care of all authentication methods for me?

Rafael Grilli
  • 1,959
  • 13
  • 25

1 Answers1

1

Do I need both to get it done or just the User Pools is enough?
No. Userpool is more than enough if you just need authentication and do not need to use AWS services.

I already got the user logged in via facebook using the Federation Identities and the Facebook SDK, but I don't know how to keep the user data saved after getting the token from facebook auth.
What user data do you need to save. If you want User's profile data to be saved in Cognito, you need to use Cognito Userpool & not Federated Identities. Add Facebook directly to Userpool. Upon using Facebook login, a user is auto-created in the userpool based on all user data available in the token. See this doc on how to add Facebook to a userpool directly.

Also is it correct to use the facebook SDK or should I use Cognito to take care of all authentication methods for me?
Depends on your use-case. If you just want to add authentication to an app, the best way would be to Add Facebook to a Userpool directly, create an app client in the userpool for your application; enable Facebook for that app client & use Cognito Userpool's built-in UI to login using Facebook. This feature (built-in UI) is called App Integration. After successful Facebook login, a valid token will be sent to your app. Do note that the token sent to your app would be from Cognito.

Client--> Userpool built-in UI --> Redirect to Facebook --> Login using username +password --> Facebook sends its token to Cognito ( https://your-user-pool-domain/oauth2/idpresponse)-->Userpool vends its own token & redirects to the URL mentioned in the redirect_uri.

agent420
  • 3,291
  • 20
  • 27
  • thanks mate, I got it now! And what about a mobile app? When you have like social media logins and you can't use the Cognito UI built-in. Should I use the Facebook SDK instead and then pass the data (tokens + user_data) to Cognito? I'm using react native btw – Rafael Grilli Dec 20 '17 at 09:32
  • 1
    You can still use Userpool. If you want to have ur own UI, you can do so. Look at my answer to this question. https://stackoverflow.com/a/47035466/3479734 – agent420 Dec 20 '17 at 12:44