amazon-archives / amazon-cognito-auth-js

The Amazon Cognito Auth SDK for JavaScript simplifies adding sign-up, sign-in with user profile functionality to web apps.
Apache License 2.0
423 stars 232 forks source link

AuthenticationDetails is not a constructor #83

Open udf2457 opened 6 years ago

udf2457 commented 6 years ago

Hi,

I'm trying to build a simple HTML mockup and end up with AuthenticationDetails is not a constructor errors.

I've put my code into a Codepen here (although the Codepen console shows nothing when you click the button, it does happen if you put the code into a local file on your computer and open it) : https://codepen.io/anon/pen/jZWMZX?editors=1011

yuntuowang commented 6 years ago

Hi @udf2457, are you using our auth SDK sample(https://github.com/aws/amazon-cognito-auth-js/blob/master/sample/index.html)? We don't have "AuthenticationDetails" in the sample.

I am guessing you are using the CUP JS SDK. It should be defined in this way: (our CUP JS sdk currently depends on "aws-sdk": "2.177.0")
var authenticationDetails = new AWSCognito.CognitoIdentityServiceProvider.AuthenticationDetails( authenticationData);

Actually, we will remove aws-sdk dependency for CUP JS SDK soon, then authenticationDetails should be defined in this way: var authenticationDetails = new AmazonCognitoIdentity.AuthenticationDetails( authenticationData); These changes will be updated in README.md later!