Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would like to better understand the benefits of using AWS Amplify Authentication. #19

Closed
palafranchise opened this issue Nov 22, 2017 · 3 comments

Comments

@palafranchise
Copy link

This looks like an awesome new tool. Can you help me answer the following question?

When not using aws-amplify-react or aws-amplify-react-native what is the main benefit of using the AWS Amplify Auth module over using Cognito directly?

@richardzcode
Copy link
Contributor

Goal of AWS Amplify Auth is to make common tasks easy, let developer focus on their business differentiators.

Amazon Cognito signUp:

var poolData = {
        UserPoolId : '...', // Your user pool id here
        ClientId : '...' // Your client id here
    };
    var userPool = new AWSCognito.CognitoIdentityServiceProvider.CognitoUserPool(poolData);

    var attributeList = [];

    var dataEmail = {
        Name : 'email',
        Value : 'email@mydomain.com'
    };

    var dataPhoneNumber = {
        Name : 'phone_number',
        Value : '+15555555555'
    };
    var attributeEmail = new AWSCognito.CognitoIdentityServiceProvider.CognitoUserAttribute(dataEmail);
    var attributePhoneNumber = new AWSCognito.CognitoIdentityServiceProvider.CognitoUserAttribute(dataPhoneNumber);

    attributeList.push(attributeEmail);
    attributeList.push(attributePhoneNumber);

    userPool.signUp('username', 'password', attributeList, null, function(err, result){
        if (err) {
            alert(err);
            return;
        }
        cognitoUser = result.user;
        console.log('user name is ' + cognitoUser.getUsername());
    });

AWS Amplify signUp:

Amplify.configure(aws_exports);

Auth.signUp('username', 'password', 'email@mydomain.com', '+15555555555')
    .then(user => console.log(user))
    .catch(err => console.log(err));

@undefobj
Copy link
Contributor

Amplify also manages AWS Credentials gathered from Amazon Cognito Federated Identities (the above example is for Amazon Cognito User Pools). For example Instead of following this process and then signing, such as sending requests to Amazon API Gateway, Amplify does this all under the covers for you.

@github-actions
Copy link

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants