@must_be_logged_in
    def revoke_oauth_access(self, external_account, auth, save=True):
        """Revoke all access to an ``ExternalAccount``.

        TODO: This should accept node and metadata params in the future, to
            allow fine-grained revocation of grants. That's not yet been needed,
            so it's not yet been implemented.
        """
        for node in self.get_nodes_with_oauth_grants(external_account):
            try:
                addon_settings = node.get_addon(external_account.provider, deleted=True)
            except __HOLE__:
                # No associated addon settings despite oauth grant
                pass
            else:
                addon_settings.deauthorize(auth=auth)

        if User.find(Q('external_accounts', 'eq', external_account._id)).count() == 1:
            # Only this user is using the account, so revoke remote access as well.
            self.revoke_remote_oauth_access(external_account)

        for key in self.oauth_grants:
            self.oauth_grants[key].pop(external_account._id, None)
        if save:
            self.save()
dataset/ETHPy150Open CenterForOpenScience/osf.io/website/addons/base/__init__.py/AddonOAuthUserSettingsBase.revoke_oauth_access