I am trying to add AWS Cognito with Google and Facebook login. Somehow the current plugins are available not working with my current setup and I am not able to get it working for a few days now. After adding multiple bug https://github.com/agnostech/flutter_amplify/issues/4 and https://github.com/furaiev/amazon-cognito-identity-dart-2/issues/42 with no help so far. So I thought to make a get/post request to lambda with the access token (As I am login with Facebook and google but not able add a user to Cognito) and that would add the user.
AWS.config.region = 'us-XXXXXXX-1';
// Add the Google access token to the Cognito credentials login map.
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityPoolId: 'us-XXXX-1:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
RoleArn: 'arn:aws:iam::XXXXXXXX:role/Cognito_XXXXXXXXXUnauth_Role',
Logins: {
'accounts.google.com': authResult['id_token']
}
});
I am following this AWS Cognito + google signup but is there a better way to do this on the current date? Also each time user logins will it try to add the user to Cognito? Considering we have only one button for sign it or sign up.
Thanks in advance.