amazon-archives / aws-cognito-angular-quickstart

An Angular(v5)-based QuickStart single-page app utilizing Amazon Cognito, S3, and DynamoDB (Serverless architecture)
https://cognito.budilov.com
Apache License 2.0
689 stars 304 forks source link

n.update is not a function #13

Closed vinodhum closed 7 years ago

vinodhum commented 8 years ago

Hi am getting "n.update is not a function" any idea what it means ?

vbudilov commented 8 years ago

Hi @vinodhum , can you please provide more information as to when you're getting this error? How you built the project? How are you testing it?

Thanks.

vinodhum commented 8 years ago

sure, here is js included in index.html

  <script src="./jsbn.js"></script>
  <script src="./jsbn2.js"></script>
  <script src="./sjcl.js"></script>
  <script src="./moment.min.js"></script>
  <script src="./aws-cognito-sdk.min.js"></script>
  <script src="./amazon-cognito-identity.min.js"></script>
  <script src="build/js/aws-sdk.min.js"></script>

below in angular2 service.

    var authenticationData = {
        Username : 'username',
        Password : 'password',
    };
    var authenticationDetails = new AWSCognito.CognitoIdentityServiceProvider.AuthenticationDetails(authenticationData);
    var poolData = { UserPoolId : 'us-east-1_TcoKGbf7n',
        ClientId : '4pe2usejqcdmhi0a25jp4b5sh3'
    };
    var userPool = new AWSCognito.CognitoIdentityServiceProvider.CognitoUserPool(poolData);
    var userData = {
        Username : 'username',
        Pool : userPool
    };
    var cognitoUser = new AWSCognito.CognitoIdentityServiceProvider.CognitoUser(userData);
    cognitoUser.authenticateUser(authenticationDetails, {
        onSuccess: function (result) {
            console.log('access token + ' + result.getAccessToken().getJwtToken());
        },

        onFailure: function(err) {
            alert(err);
        },

    });

with above setup I am able to create user but cannot authentication. I am using it on angular2. is there any angular2 module for aws ?

vbudilov commented 8 years ago

Have you made any changes to the original code? If so, can you revert your changes and check if everything works out-of-the-box?

vinodhum commented 8 years ago

actually, aws-cognito-angular2-quickstart out of the box did not work it was giving lot of errors. so went through all the code and extracted just aws services.

vbudilov commented 8 years ago

I can try to help you with the original code, but most likely won't be able to help you with the derivative.

If you tell me which errors you saw with the original code, and how to replicate those errors, then I can try to help you out.

Thanks, Vladimir

vinodhum commented 7 years ago

ok thanx I was able to make it work. I had to use all the sdk versions from original code.

vinodhum commented 7 years ago

I can authenticate but after auth it gives me this error "message":"Token is not from a supported provider of this identity pool" any idea what it means ?

vbudilov commented 7 years ago

@vinodhum , I've googled it for you and see a lot of possible solutions. Here's one: http://stackoverflow.com/questions/37914184/using-dynamodb-with-cognito-token-is-not-from-a-supported-provider-of-this-iden

I'm going to close this case since the initial problem isn't with the original code. You can always reopen it if you feel that it is.

Thanks for using the project!

Vladimir