Skip to content

Commit

Permalink
check token after restoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Akiyamka committed Aug 22, 2023
1 parent e59a14c commit 59f6c7c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,18 @@ class AppController extends SimpleState<AppControllerState> {
_postLogout();
sessionStorage.dropSession();
},
);
);

api = ApiClient(openIdClient);

session = await sessionStorage.restoreLast();
Tokens? lastTokens = session.tokens;
if (lastTokens != null) {
openIdClient.loginByTokens(lastTokens);
try {
await openIdClient.loginByTokens(lastTokens);
} catch (e) {
logger.info('Tokens expired, re-logout ($e)');
}
}
setState(() {
state.isBooted = true;
Expand Down

0 comments on commit 59f6c7c

Please sign in to comment.