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

Fixed tokens being empty strings #94

Closed mymattcarroll closed 6 years ago

mymattcarroll commented 6 years ago

The current constructor is setting this.signInUserSession to a new instance of CognitoAuthSession. When refreshing the browser of a single page application, getSignInUserSession().getIdToken().getJwtToken() returns an empty string ("").

The changes proposed fix this issue.

mymattcarroll commented 6 years ago

@yuntuowang is there any chance of this contribution being considered? It is currently blocking us from using this SDK in production.

mymattcarroll commented 6 years ago

@yuntuowang, getCachedSession() function will never return null. I am happy to put that back in if you'd like?

yuntuowang commented 6 years ago

Hi @mymattcarroll, I get your point. Better to add "this.getCachedSession() != null" back to be clearer.

I think your change is valid. I will merge it soon. Thanks!

mymattcarroll commented 6 years ago

@yuntuowang, I have added back in the check for null.

Cheers.

yuntuowang commented 6 years ago

Hi @mymattcarroll, you fix has been pushed and published on NPM too. Thanks a lot for your contribution!!