Fix expiresIn (convert String to Int)
diff --git a/lib/src/handle_access_token_response.dart b/lib/src/handle_access_token_response.dart
index 370ffcb..ba78d94 100644
--- a/lib/src/handle_access_token_response.dart
+++ b/lib/src/handle_access_token_response.dart
@@ -68,9 +68,18 @@
}
var expiresIn = parameters['expires_in'];
- if (expiresIn != null && expiresIn is! int) {
- throw FormatException(
- 'parameter "expires_in" was not an int, was "$expiresIn"');
+ if (expiresIn != null) {
+ if (expiresIn is String) {
+ try {
+ expiresIn = double.tryParse(expiresIn).toInt();
+ } catch (e) {
+ throw FormatException(
+ 'parameter "expires_in" was not an int, and given string cant not be parsed to int : "$expiresIn"');
+ }
+ } else if (expiresIn is! int) {
+ throw FormatException(
+ 'parameter "expires_in" was not an int, was of type ${expiresIn.runtimeType.toString()} value : "$expiresIn"');
+ }
}
for (var name in ['refresh_token', 'id_token', 'scope']) {