diff --git a/rtv/oauth.py b/rtv/oauth.py index afa0c32..7edf7b5 100644 --- a/rtv/oauth.py +++ b/rtv/oauth.py @@ -94,6 +94,12 @@ class OAuthTool(object): with open(self.config_fp, 'w') as cfg: self.config.write(cfg) + def clear_oauth_data(self): + self.open_config(update=True) + if self.config.has_section('oauth') and self.config.has_option('oauth', 'refresh_token'): + self.config.remove_option('oauth', 'refresh_token') + self.save_config() + def authorize(self): if self.compact and not '.compact' in self.reddit.config.API_PATHS['authorize']: self.reddit.config.API_PATHS['authorize'] += '.compact' diff --git a/rtv/page.py b/rtv/page.py index 9eb9025..34a5467 100644 --- a/rtv/page.py +++ b/rtv/page.py @@ -352,6 +352,7 @@ class BasePage(object): if self.reddit.is_oauth_session(): self.reddit.clear_authentication() + self.oauth.clear_oauth_data() return self.oauth.authorize()