diff --git a/flutter_appauth/CHANGELOG.md b/flutter_appauth/CHANGELOG.md index 2e6f8f2..a35eb66 100644 --- a/flutter_appauth/CHANGELOG.md +++ b/flutter_appauth/CHANGELOG.md @@ -1,6 +1,7 @@ ## [8.0.0-dev.4] * [Android] no functional changes but some code around dealing with `allowInsecureConnections` has been done in response to issue [554](https://github.com/MaikuB/flutter_appauth/issues/554) +* [Android] added logic to help with issues like [205](https://github.com/MaikuB/flutter_appauth/issues/205) where an app tries to refresh a token but the instances of `AuthorizationService` have been disposed ## [8.0.0-dev.3] diff --git a/flutter_appauth/android/src/main/java/io/crossingthestreams/flutterappauth/FlutterAppauthPlugin.java b/flutter_appauth/android/src/main/java/io/crossingthestreams/flutterappauth/FlutterAppauthPlugin.java index ed2acc9..d7d8a3a 100644 --- a/flutter_appauth/android/src/main/java/io/crossingthestreams/flutterappauth/FlutterAppauthPlugin.java +++ b/flutter_appauth/android/src/main/java/io/crossingthestreams/flutterappauth/FlutterAppauthPlugin.java @@ -579,6 +579,10 @@ private void performEndSessionRequest( } private AuthorizationService getAuthorizationService() { + if (insecureAuthorizationService == null || defaultAuthorizationService == null) { + // There have been some reported instances where the services have been disposed but they're still needed e.g. to refresh token + createAuthorizationServices(); + } AuthorizationService authorizationService = allowInsecureConnections ? insecureAuthorizationService : defaultAuthorizationService; return authorizationService;