Fix MyAnimeList expiresIn retrieval

Remove incorrect expiresIn calculation in `OAuth.fromJson`. The `login()`
function of the MyAnimeList class already sets expiresIn as an absolute timestamp in milliseconds.
Multiplying by 1000 and adding the current timestamp in fromJson caused
expiresIn to be inflated, making the expiration check in `_getAccessToken()`
always false, skipping token refresh and returning an invalid token.
This commit is contained in:
NBA2K1 2025-05-04 22:36:54 +02:00
parent 1014c71f5c
commit 73e7ad05f9

View file

@ -8,9 +8,7 @@ class OAuth {
OAuth.fromJson(Map<String, dynamic> json) {
tokenType = json['token_type'];
expiresIn =
(json['expires_in'] as int) * 1000 +
DateTime.now().millisecondsSinceEpoch;
expiresIn = json['expires_in'] as int;
accessToken = json['access_token'];
refreshToken = json['refresh_token'];
}