Fix existing token not being validated properly

This commit is contained in:
tommyxchow 2022-04-06 03:04:11 -04:00
parent cd6e5c5747
commit 77e604cf50

View file

@ -64,18 +64,18 @@ abstract class _AuthBase with Store {
await _storage.write(key: _defaultTokenKey, value: _token);
}
} else {
// Validate the existing token.
_tokenIsValid = await twitchApi.validateToken(token: _token!);
// If the token is invalid, logout.
if (!_tokenIsValid) return await logout();
// Initialize the user store.
await user.init(headers: headersTwitch);
if (user.details != null) _isLoggedIn = true;
}
// Validate the token.
_tokenIsValid = await twitchApi.validateToken(token: _token!);
// If the token is invalid, logout.
if (!_tokenIsValid) await logout();
_error = null;
} catch (e) {
debugPrint(e.toString());