benbaran / adal-angular4

Angular 4/5/6/7 ADAL Wrapper
MIT License
86 stars 104 forks source link

Wrong timer interval in loginRefreshTimer #73

Closed simon11196 closed 6 years ago

simon11196 commented 6 years ago

You calculate the interval with 'exp - this.now() - 300' which are seconds. But the rxjs timer requires milliseconds as interval time.

this.loginRefreshTimer = timer(exp - this.now() - 300).subscribe((x) => { this.refreshLoginToken() });

In my example the token expires in ~37000 seconds but the timer is triggered every ~37 seconds image

So i think it should be something like this: this.loginRefreshTimer = timer((exp - this.now() - 300) * 1000).subscribe((x) => { this.refreshLoginToken() });

geerzo commented 6 years ago

Good catch. I'll fix this.

geerzo commented 6 years ago

This is fixed in ecf866607cd51b74727da38daba0b3c0d87a81ae