<commit_before>'use strict';

import 'angularfire';
import Firebase from 'firebase';

import { FIREBASEPATH } from '../common';

let AuthFactory = function ($firebaseAuth, $rootScope, $cookies) {

  let ref = new Firebase(FIREBASEPATH);
  let auth = $firebaseAuth(ref);

  /**
   * Login
   */

  let login = (cb) => {
    auth.$authWithOAuthPopup('facebook').then(function (authData) {
      console.log('Logged in as:', authData.uid);
      $rootScope.$emit('USER_LOGGED_IN', authData);
      cb(authData);
    }).catch(function (error) {
      console.log('Authentication failed:', error);
    });
  };

  /**
   * Logout
   */

  let logout = () => {
    ref.unauth();
    $cookies.remove('user');
  };

  return { login, logout };
};

export default AuthFactory;<commit_msg>Fix oauth<commit_after>'use strict';

import 'angularfire';
import Firebase from 'firebase';

import { FIREBASEPATH } from '../common';

let AuthFactory = function ($firebaseAuth, $rootScope, $cookies) {

  let ref = new Firebase(FIREBASEPATH);
  let auth = $firebaseAuth(ref);

  /**
   * Login
   */

  let login = (cb) => {
    auth.$authWithOAuthRedirect('facebook').then(function (authData) {
      console.log('Logged in as:', authData.uid);
      $rootScope.$emit('USER_LOGGED_IN', authData);
      cb(authData);
    }).catch(function (error) {
      console.log('Authentication failed:', error);
    });
  };

  /**
   * Logout
   */

  let logout = () => {
    ref.unauth();
    $cookies.remove('user');
  };

  return { login, logout };
};

export default AuthFactory;
{'fraction_non_alphanumeric': 0.17212588310854207, 'fraction_numerical': 0.0, 'mean_word_length': 3.303867403314917, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, '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': '7134918', 'n_tokens_mistral': 527, 'n_tokens_neox': 514, 'n_words': 108}