Advertisement
Guest User

Untitled

a guest
Jul 14th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. InvalidParameterType: Expected params.Username to be a string
  2.  
  3. forgotPassword(username: string){
  4. console.log("forgotPassword called for..", username);
  5.  
  6. let appClientInfo = {
  7. "userpoolId": "pool ID",
  8. "appClientId": "client ID"
  9. }
  10.  
  11. var poolData = {
  12. UserPoolId : appClientInfo.userpoolId, // Your user pool id here
  13. ClientId : appClientInfo.appClientId // Your client id here
  14. };
  15.  
  16. var userPool = new AWSCognito.CognitoIdentityServiceProvider.CognitoUserPool(poolData);
  17. console.log("userPool..",userPool);
  18. var userData = {
  19. Username : username,
  20. Pool : userPool
  21. };
  22.  
  23. var cognitoUser = new AWSCognito.CognitoIdentityServiceProvider.CognitoUser(userData);
  24. console.log("cognitoUser..",cognitoUser);
  25.  
  26. cognitoUser.forgotPassword({
  27. onSuccess: function (result) {
  28. // successfully initiated forgot password request
  29. console.log('CodeDeliveryData from forgotPassword: ' + result);
  30. this.router.navigate(['login']);
  31.  
  32. },
  33. onFailure: function(err) {
  34. alert(err);
  35. console.log('error: ' + err);
  36. }
  37.  
  38. });
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement