<commit_before>// This is the Fetch User Profile Script for FxA
// latest-dev URLs:
// Authorization endpoint: https://oauth-latest.dev.lcip.org/v1/authorization
// Token endpoint: https://oauth-latest.dev.lcip.org/v1/token
// scopes: openid profile
function(accessToken, ctx, cb) {
  // An Fxa profile looks like:
  //     {
  //      "email": "<EMAIL>",
  //      "uid": "14e701f4bfd647ce925c0239a2065665",
  //      "sub": "14e701f4bfd647ce925c0239a2065665"
  //  }
  // See docs at https://developer.mozilla.org/en-US/docs/Mozilla/Tech/Firefox_Accounts/Introduction
  request.get('https://latest.dev.lcip.org/profile/v1/profile', {
    'headers': {
      'Authorization': 'Bearer ' + accessToken,
      'User-Agent': 'MozillaIAM-Auth0'
    }
  }, function(e, r, b) {
    if (e) return callback(e);
    if (r.statusCode !== 200) {
      return cb(new Error('Failed to fetch user profile. StatusCode:' + r.statusCode));
    }

    var p = JSON.parse(b);
    return cb(null, {
      user_id: p.uid,
      email: p.email,
      email_verified: true,
      fxa_sub: p.sub
    });

  });
}
<commit_msg>Support newer fxa claims for twofa, picture, etc.<commit_after>// This is the Fetch User Profile Script for FxA
// latest-dev URLs:
// Authorization endpoint: https://oauth-latest.dev.lcip.org/v1/authorization
// Token endpoint: https://oauth-latest.dev.lcip.org/v1/token
// scopes: openid profile
function(accessToken, ctx, cb) {
  // See docs at https://developer.mozilla.org/en-US/docs/Mozilla/Tech/Firefox_Accounts/Introduction
  request.get('https://latest.dev.lcip.org/profile/v1/profile', {
    'headers': {
      'Authorization': 'Bearer ' + accessToken,
      'User-Agent': 'MozillaIAM-Auth0'
    }
  }, function(e, r, b) {
    if (e) return callback(e);
    if (r.statusCode !== 200) {
      return cb(new Error('Failed to fetch user profile. StatusCode:' + r.statusCode));
    }

    var p = JSON.parse(b);
    // If you need to debug FxA's reply, un-comment this and look at the webtask logs
    // console.log('FxA profile output: '+p);
    return cb(null, {
      user_id: p.uid,
      picture: p.avatar,
      preferredLanguage: p.locale,
      email: p.email,
      email_verified: true,
      fxa_sub: p.sub,
      fxa_amrValues: p.amrValues,
      fxa_twoFactorAuthentication: p.twoFactorAuthentication
    });

  });
}

{'fraction_non_alphanumeric': 0.1514114627887083, 'fraction_numerical': 0.02566295979469632, 'mean_word_length': 2.866115702479339, 'pattern_counts': {'":': 3, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, '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': '3907864', 'n_tokens_mistral': 867, 'n_tokens_neox': 817, 'n_words': 179}