<commit_before>DropboxOAuth = {};

OAuth.registerService('dropbox', 2, null, function(query) {
    var response = getTokens(query);
    var accessToken = response.accessToken;
    var identity = getIdentity(accessToken);

    var serviceData = {
        id: identity.uid,
        accessToken: accessToken,
        expiresAt: (+new Date()) + (1000 * response.expiresIn)
    };

    // include all fields from dropbox
    // https://www.dropbox.com/developers/core/docs#account-info
    var fields = _.pick(identity, ['display_name', 'country']);
    _.extend(serviceData, fields);

    return {
        serviceData: serviceData,
        options: {
            profile: { name: identity.display_name }
        }
    };
});

// returns an object containing:
// - accessToken
// - expiresIn: lifetime of token in seconds
var getTokens = function (query) {
  var config = ServiceConfiguration.configurations.findOne({service: 'dropbox'});
  if (!config)
    throw new ServiceConfiguration.ConfigError();

  var response;
  try {
    var redirectUri = OAuth._redirectUri('dropbox', config, {}, {secure: true}).replace('?close&', '?close=true&');<commit_msg>Another pattern for response error<commit_after>DropboxOAuth = {};

OAuth.registerService('dropbox', 2, null, function(query) {
    var response = getTokens(query);
    var accessToken = response.accessToken;
    var identity = getIdentity(accessToken);

    var serviceData = {
        id: identity.uid,
        accessToken: accessToken,
        expiresAt: (+new Date()) + (1000 * response.expiresIn)
    };

    // include all fields from dropbox
    // https://www.dropbox.com/developers/core/docs#account-info
    var fields = _.pick(identity, ['display_name', 'country']);
    _.extend(serviceData, fields);

    return {
        serviceData: serviceData,
        options: {
            profile: { name: identity.display_name }
        }
    };
});

// returns an object containing:
// - accessToken
// - expiresIn: lifetime of token in seconds
var getTokens = function (query) {
  var config = ServiceConfiguration.configurations.findOne({service: 'dropbox'});
  if (!config)
    throw new ServiceConfiguration.ConfigError();

  var response;
  try {
    var redirectUri = OAuth._redirectUri('dropbox', config, {}, {secure: true}).replace('?close', '?close=true');
{'fraction_non_alphanumeric': 0.13528651443343387, 'fraction_numerical': 0.004308487720809996, 'mean_word_length': 3.292051756007394, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3345932', 'n_tokens_mistral': 672, 'n_tokens_neox': 656, 'n_words': 161}