keratin / authn-js

JavaScript client library for Keratin AuthN
GNU Lesser General Public License v3.0
45 stars 20 forks source link

Restoring expired tokens #15

Closed cainlevy closed 7 years ago

cainlevy commented 7 years ago

When an app (page) initializes, Keratin looks for an existing token and kicks off its maintenance strategy. This was happening behind the scenes, with no way for the host app to know if and when a session had been found.

Further, the existing token might have expired. Keratin would attempt to refresh it, but would meanwhile expose the expired token to the host app.

This changeset fixes both. The setFooStore methods will now return a promise that is fulfilled when a session is found and viable. This is an asynchronous process because it might require first refreshing the token from the AuthN server.

fixes #13