12

I would like to use a Cognito User Pool for Facebook logins only, which may be possible using the built in login form, but I need to use my own.

Theoretically, when it comes to a custom form, it shouldn't be hard: after I receive a user object from FB, I bind the user and email attributes to the ones in my User Pool and I save it.

But what to do about the password field and future authentication? And here I have failed during my journey...

...
userPool.signUp('FoobarUser', '**password?**', attributeList, null, function(err, result){
...

While digging deeper into the docs, I tried to implement a Identity Pool (Federated Identities), managed to save user info in the form of datasets as well, but then I realised, querying these sets gonna be a huge pain if possible at all.

Maybe I'm failing to understand the concepts, I would be really thankful if someone could suggest a way to manage facebook logins in a nicely organised fashion using Cognito.

1 Answer 1

23

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

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.

1
  • 3
    By the way, this solution works only if the user first authorized the app, after that it can be used for signing in without the need of the built in UI. So I guess there is no other way right now than using the UI... :(( Commented Oct 31, 2017 at 16:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.