Skip to content

Commit

Permalink
Fallback to issued
Browse files Browse the repository at this point in the history
  • Loading branch information
peteruithoven committed May 18, 2017
1 parent 1870be3 commit 31202b4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ class Superlogin extends EventEmitter2 {
if (!this._session || !this._session.user_id) {
return Promise.reject();
}
const refreshed = this._session.refreshed;
// try getting the latest refresh date, if not available fall back to issued date
const refreshed = this._session.refreshed || this._session.issued;
const expires = this._session.expires;
const threshold = isNaN(this._config.refreshThreshold) ? 0.5 : this._config.refreshThreshold;
const duration = expires - refreshed;
Expand Down

0 comments on commit 31202b4

Please sign in to comment.