Fix default token not validating on init
This commit is contained in:
parent
9e9862d491
commit
316efa4033
1 changed files with 9 additions and 0 deletions
|
|
@ -62,6 +62,15 @@ abstract class _AuthBase with Store {
|
|||
if (_token == null) {
|
||||
_token = await twitchApi.getDefaultToken();
|
||||
await _storage.write(key: _defaultTokenKey, value: _token);
|
||||
} else {
|
||||
// Validate the existing default token.
|
||||
_tokenIsValid = await twitchApi.validateToken(token: _token!);
|
||||
|
||||
// If the existing default token is invalid, get and store a new one.
|
||||
if (!_tokenIsValid) {
|
||||
_token = await twitchApi.getDefaultToken();
|
||||
await _storage.write(key: _defaultTokenKey, value: _token);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Validate the existing token.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue