aws-cognito-angular-quickstart
aws-cognito-angular-quickstart copied to clipboard
Cannot read property 'ddb' of undefined
Hi, it is a good example of how to use aws cognito to users manage, I am beginning in the programming world and I am learning. I have tested the code and it is showing an issue in the console about "Cannot read property 'ddb' of undefined". I checked that it refers to aws.service.ts file and the line 95, there is a variable called ddb used. How and where should it be declared to remove the issue?
I have tried different ways and the issue doesn't disappear.
Thanks in advance.
I copy where the var is used.
addCognitoCredentials(idTokenJwt: string): void { let creds = this.cognitoUtil.buildCognitoCreds(idTokenJwt);
AWS.config.credentials = creds; creds.get(function (err) { if (!err) { if (AwsUtil.firstLogin) { // save the login info to DDB this.ddb.writeLogEntry("login"); AwsUtil.firstLogin = false; } } }); }
More information, the issue occurs when: -Login in the app -Close the tap -Open the app and it appears in the console.