Index: utils/pub/oauth2.dart |
diff --git a/utils/pub/oauth2.dart b/utils/pub/oauth2.dart |
index 7cc5c852a81d4c7b4cfc2331d1a45913e28e94c0..c7a87fdea7603274411a40b0f716f48f566f88e6 100644 |
--- a/utils/pub/oauth2.dart |
+++ b/utils/pub/oauth2.dart |
@@ -47,6 +47,16 @@ final _scopes = ['https://www.googleapis.com/auth/userinfo.email']; |
/// the same as the credentials file stored in the system cache. |
Credentials _credentials; |
+/// Delete the cached credentials, if they exist. |
+Future clearCredentials(SystemCache cache) { |
+ _credentials = null; |
+ var credentialsFile = _credentialsFile(cache); |
+ return fileExists(credentialsFile).chain((exists) { |
+ if (exists) return deleteFile(credentialsFile); |
+ return new Future.immediate(null); |
+ }); |
+} |
+ |
/// Asynchronously passes an OAuth2 [Client] to [fn], and closes the client when |
/// the [Future] returned by [fn] completes. |
/// |