<commit_before>const keycloakRedirect = require('keycloak-redirect');

/**
 * Init Key Cloak Redirect
 * @see ./entry-point.sh for window.config declaration and assignment
 * @returns {boolean}
 * @example Local environment, update config:
 *  var config = {
 *   "keycloakUrl": 'https://keycloak.digital.homeoffice.gov.uk/auth/realms/ircbd/protocol/openid-connect/auth',
 *   "backend": 'https://api.ircbd.homeoffice.gov.uk/',
 *   "clientId": "ircbd-api"
 * };
 */
function KeycloakInitService($window) {
  'ngInject';
  var config = window.config;
  var client = new XMLHttpRequest();
  keycloakRedirect.authenticate(config, client, $window);

  return true;
}

export default {
  name: 'KeycloakInitService',
  fn: KeycloakInitService
};<commit_msg>delay the keycloak redirect to give it a chance to get a session from sails<commit_after>const keycloakRedirect = require('keycloak-redirect');

/**
 * Init Key Cloak Redirect
 * @see ./entry-point.sh for window.config declaration and assignment
 * @returns {boolean}
 * @example Local environment, update config:
 *  var config = {
 *   "keycloakUrl": 'https://keycloak.digital.homeoffice.gov.uk/auth/realms/ircbd/protocol/openid-connect/auth',
 *   "backend": 'https://api.ircbd.homeoffice.gov.uk/',
 *   "clientId": "ircbd-api"
 * };
 */
function KeycloakInitService($window) {
  'ngInject';
  var config = window.config;
  var client = new XMLHttpRequest();
  setTimeout(function () {
    keycloakRedirect.authenticate(config, client, $window);
  }, 2000);

  return true;
}

export default {
  name: 'KeycloakInitService',
  fn: KeycloakInitService
};
{'fraction_non_alphanumeric': 0.14294592914853946, 'fraction_numerical': 0.002486016159105034, 'mean_word_length': 4.4391891891891895, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '5300951', 'n_tokens_mistral': 555, 'n_tokens_neox': 519, 'n_words': 116}