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
424 stars 232 forks source link

Removing needless xhr.open call that is handled in if/else logic, and… #152

Closed VicFrolov closed 5 years ago

VicFrolov commented 5 years ago

Issue #, if available: https://github.com/aws-amplify/amplify-js/issues/1143

Description of changes: 1) Removing needless xhr.open call found here: https://github.com/aws/amazon-cognito-auth-js/blob/1ea0f1d9282201f31411ac87b8a96a244793c1f4/src/CognitoAuth.js#L571

It occurs once on function call, and then again in the first if clause if conditions are met. 

The second if else changes the logic of xhr, so this seems needless. Removing it solves the error `[Error: Cannot open, already sending]`. 

2) Adding a brief comment in the README, as it was not clear to remove the protocol in the AppWebDomain parameter, which was causing https://https:// as the SDK prepends the protocol to the request.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

manueliglesias commented 5 years ago

Closed by #75