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 {
68
68
OAuthInterceptor get interceptor => OAuthInterceptor (this );
69
69
70
70
/// 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]
72
73
Future <OAuthToken ?> refresh () async {
73
74
final credentialsJson = await _storage.fetchCredentials ();
74
75
if (credentialsJson == null ) return null ;
@@ -78,7 +79,7 @@ class OAuthChopper {
78
79
await credentials.refresh (identifier: identifier, secret: secret);
79
80
await _storage.saveCredentials (newCredentials.toJson ());
80
81
return OAuthToken .fromCredentials (newCredentials);
81
- } catch (e) {
82
+ } on AuthorizationException {
82
83
_storage.clear ();
83
84
rethrow ;
84
85
}
You can’t perform that action at this time.
0 commit comments