def construct_state_param_for_add(self, state=None, **kwargs): """Construct the state parameter if one isn't explicitly passed in. The following keys are common: - operation: 'add' or 'delete' - feature: 'listen', 'publish', or 'webmention' - callback: an optional external callback, that we will redirect to at the end of the authorization handshake - source: the source key, only applicable to deletes """ state_obj = util.decode_oauth_state(state) if not state_obj: state_obj = {field: self.request.get(field) for field in ('callback', 'feature', 'id', 'user_url')} state_obj['operation'] = 'add' if kwargs: state_obj.update(kwargs) return util.encode_oauth_state(state_obj)
def construct_state_param_for_add(self, state=None, **kwargs): """Construct the state parameter if one isn't explicitly passed in. The following keys are common: - operation: 'add' or 'delete' - feature: 'listen', 'publish', or 'webmention' - callback: an optional external callback, that we will redirect to at the end of the authorization handshake - source: the source key, only applicable to deletes """ state_obj = util.decode_oauth_state(state) if not state_obj: state_obj = {field: self.request.get(field) for field in ('callback', 'feature', 'id', 'user_url')} state_obj['operation'] = 'add' if kwargs: state_obj.update(kwargs) return util.encode_oauth_state(state_obj)