FB.login(function (response) {
// Check if the user logged in successfully.
if (response.authResponse) {
console.log("You are now logged in.");
// Add the Facebook access token to the Cognito credentials login map.
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityPoolId: "IDENTITY_POOL_ID",
Logins: {
"graph.facebook.com": response.authResponse.accessToken,
},
});
// Obtain AWS credentials
AWS.config.credentials.get(function () {
// Access AWS resources here.
});
} else {
console.log("There was a problem logging you in.");
}
});
Ensure auth is added to the project wsmobile user-signin configure and selecting Advanced > Add Facebook.