def grant_oauth_access(self, node, external_account, metadata=None):
        # ensure the user owns the external_account
        if external_account not in self.owner.external_accounts:
            raise PermissionsError()

        metadata = metadata or {}

        # create an entry for the node, if necessary
        if node._id not in self.oauth_grants:
            self.oauth_grants[node._id] = {}

        # create an entry for the external account on the node, if necessary
        if external_account._id not in self.oauth_grants[node._id]:
            self.oauth_grants[node._id][external_account._id] = {}

        # update the metadata with the supplied values
        for key, value in metadata.iteritems():
            self.oauth_grants[node._id][external_account._id][key] = value

        self.save()
Give a node permission to use an ``ExternalAccount`` instance.
dataset/ETHPy150Open CenterForOpenScience/osf.io/website/addons/base/__init__.py/AddonOAuthUserSettingsBase.grant_oauth_access