OAuthToken.fromJsonFile constructor
OAuthToken.fromJsonFile(
- String path
Creates new OAuthToken from a Json file stored in path
.
Implementation
factory OAuthToken.fromJsonFile(String path) {
final file = File(path);
final jsonData = jsonDecode(file.readAsStringSync()) as JsonMap;
return OAuthToken(
scope: jsonData['scope'] as DefaultScope,
tokenType: jsonData['token_type'] as Bearer,
accessToken: jsonData['access_token'] as String,
refreshToken: jsonData['refresh_token'] as String,
expiresAt: jsonData['expires_at'] as int,
expiresIn: jsonData['expires_in'] as int,
);
}