File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,8 @@ class OAuthChopper {
6868 OAuthInterceptor get interceptor => OAuthInterceptor (this );
6969
7070 /// Tries to refresh the available credentials and returns a new [OAuthToken] instance.
71- /// Throws an exception when refreshing fails. See [Credentials.refresh]
71+ /// Throws an exception when refreshing fails. If the exception is a [AuthorizationException] it clears the storage.
72+ /// See [Credentials.refresh]
7273 Future <OAuthToken ?> refresh () async {
7374 final credentialsJson = await _storage.fetchCredentials ();
7475 if (credentialsJson == null ) return null ;
@@ -78,7 +79,7 @@ class OAuthChopper {
7879 await credentials.refresh (identifier: identifier, secret: secret);
7980 await _storage.saveCredentials (newCredentials.toJson ());
8081 return OAuthToken .fromCredentials (newCredentials);
81- } catch (e) {
82+ } on AuthorizationException {
8283 _storage.clear ();
8384 rethrow ;
8485 }
You can’t perform that action at this time.
0 commit comments