Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let authenticationData = {
- Username: username,
- Password: password,
- };
- let authenticationDetails = new AWSCognito.CognitoIdentityServiceProvider.AuthenticationDetails(authenticationData);
- let userData = {
- Username: username,
- Pool: this.cUtil.getUserPool()
- };
- console.log("Authenticating the user");
- let cognitoUser = new AWSCognito.CognitoIdentityServiceProvider.CognitoUser(userData);
- cognitoUser.authenticateUser(authenticationDetails, {
- onSuccess: function (result) {
- var logins = {};
- var loginKey = 'cognito-idp.' +
- _REGION +
- '.amazonaws.com/' +
- _USER_POOL_ID;
- console.log("identity pool id: " + _IDENTITY_POOL_ID);
- console.log("login key: " + loginKey);
- console.log("user: " + JSON.stringify(cognitoUser));
- logins[loginKey] = result.getIdToken().getJwtToken();
- console.log("logins: " + JSON.stringify(logins));
- AWS.config.credentials = new AWS.CognitoIdentityCredentials({
- 'IdentityPoolId': _IDENTITY_POOL_ID,
- 'Logins': logins
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement