AWS Amplify Facebook Login, Federated Identities
See original GitHub issue** 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}`);
}
}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Authentication - Advanced workflows - JavaScript - Amplify Docs
You can alternatively use Auth.federatedSignIn() to get AWS credentials directly from Cognito Federated Identities and not use User Pool federation.
Read more >Facebook Login with Cognito using AWS Amplify - SST.Dev
Next we are going to use Cognito Identity Pool to federate our identities. This means that when a user signs up with their...
Read more >Facebook (identity pools) - Amazon Cognito
Amazon Cognito identity pools integrate with Facebook to provide federated authentication for your mobile application users. This section explains how to ...
Read more >The Complete Guide to Implement Social Login With AWS ...
Learn about how to set up a full-stack serverless ReactJS application using AWS Amplify with Google and Facebook Login functionality.
Read more >The Complete Guide to User Authentication with the Amplify ...
The easiest way to do this will be by using the Auth.federatedSignIn() method from the Auth class from AWS Amplify.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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?
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