<commit_before>import firebase from 'firebase'
import {createUser} from './helpers'

export default function getUser () {
  return new Promise((resolve, reject) => {
    firebase.auth().getRedirectResult()
    .then(
      (result) => {
        if (result.user) {
          const user = createUser(result.user)

          if (result.credential) {
            user.accessToken = result.credential.accessToken
          }
          resolve({
            user: user
          })
        } else {
          const unsubscribe = firebase.auth().onAuthStateChanged(user => {
            unsubscribe()
            resolve({
              user: user ? createUser(user) : null
            })
          })
        }
      },
      (error) => {
        reject({
          code: error.code,
          message: error.message,
          email: error.email
        })
      }
    )
  })
}<commit_msg>feat(firebase): add redirected info on getUser (#590)<commit_after>import firebase from 'firebase'
import {createUser} from './helpers'

export default function getUser () {
  return new Promise((resolve, reject) => {
    firebase.auth().getRedirectResult()
    .then(
      (result) => {
        if (result.user) {
          const user = createUser(result.user)

          if (result.credential) {
            user.accessToken = result.credential.accessToken
          }
          resolve({
            user: user,
            isRedirected: true
          })
        } else {
          const unsubscribe = firebase.auth().onAuthStateChanged(user => {
            unsubscribe()
            resolve({
              user: user ? createUser(user) : null,
              isRedirected: false
            })
          })
        }
      },
      (error) => {
        reject({
          code: error.code,
          message: error.message,
          email: error.email
        })
      }
    )
  })
}
{'fraction_non_alphanumeric': 0.11733333333333333, 'fraction_numerical': 0.0016, 'mean_word_length': 1.5454545454545454, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '5894472', 'n_tokens_mistral': 508, 'n_tokens_neox': 502, 'n_words': 108}