* AWS Authentication *
I am using Cognito User Pools to manage user Sign-Up and Sign-In. I also want to login with facebook. The documentation says that we don't need to use Auth.federatedSignIn() , so I am not sure what else to be used and how?

here;s my code so far
loginFB = async (params) => {
try {
const {
type,
token,
expires,
permissions,
declinedPermissions,
} = await Facebook.logInWithReadPermissionsAsync('414271525994061', {
permissions: ['public_profile,email'], behavior: 'native'
});
console.log('type:', type);
console.log('token:', token);
if (type === 'success') {
// Get the user's name using Facebook's Graph API
const response = await fetch(`https://graph.facebook.com/me?access_token=${token}`);
// Alert.alert('Logged in!', `Hi ${(await response.json()).name}!`);
const user = {
name: response.name,
email: response.email
};
const date = new Date();
const expires_at = expires * 1000 + date.getTime();
Auth.federatedSignIn('facebook', { token, expires_at }, user)
.then(credentials => {
console.log(credentials);
});
} else {
// type === 'cancel'
}
} catch ({ message }) {
alert(`Facebook Login Error: ${message}`);
}
}
@daniyal-intellicel Hi, to federate with the Cognito User Pool, you should use the Cognito Hosted UI: https://aws-amplify.github.io/docs/js/authentication#using-amazon-cognito-hosted-ui
I am facing same issue, i am using user pools for sign-up and sign-in.
Now i want to use facebook, instagram, twitter etc. with aws cognito.
Here if i want to combine all users from external provider, then how can we achieve that?
Can you please explain me
@khalaniaiyaj to federated with the user pool, you should use the Cognito Hosted UI. Could you check https://aws-amplify.github.io/docs/js/authentication#using-amazon-cognito-hosted-ui?
@powerful23 I don鈥檛 want to use inbuilt UI, i want federated user in cognito pool via custom UI. Is it possible?
@khalaniaiyaj as I know it's impossible. You can go to the AWS forum and post this issue to Cognito service team: https://aws.amazon.com/premiumsupport/knowledge-center/send-feedback-aws/
@daniyal-intellicel your code looks good to me, what is the issue you are experiencing?
@khalaniaiyaj I can explain a little and I hope this is more clear for you.
I am assuming you want to have a user database with every app user, this means users that login with username and password, Google Sign in, Facebook login, etc. Using attribute mapping you can have a single user database with the attributes in common for every provider.
To make this happen, Cognito User Pools provides a functionality called Hosted UI, this allows you to authenticate your users and also map their information into this single user database.
Hosted UI doesn't necessary mean you need to use that UI in your app, you can have your own UI that will used Hosted UI only to redirect to the provider of choice (imagine you have multiple buttons to sign in with....). For react-native Amplify has an HOC that you can use in order to have your own UI (you can also use Cognito UI) in your app. Take a look here for more information
Closing this issue due to inactivity and it appears that questions have been answered.
I am facing same issue, i am using user pools for sign-up and sign-in.
Now i want to use facebook, instagram, twitter etc. with aws cognito.
Here if i want to combine all users from external provider, then how can we achieve that?
Can you please explain me
did you find any solution for this
Most helpful comment
I am facing same issue, i am using user pools for sign-up and sign-in.
Now i want to use facebook, instagram, twitter etc. with aws cognito.
Here if i want to combine all users from external provider, then how can we achieve that?
Can you please explain me