function login () {
  return new Promise((resolve, reject) => {
    let idToken
    // let accessToken, username

    try {
      window.location.hash
        .replace(/^#/, '')
        .split('&')
        .map(param => param.split('='))
        .forEach(param => {
          // record the id_token and access_token
          if (param[0] === 'id_token') idToken = param[1]
          // if (param[0] === 'access_token') accessToken = param[1]
        })

      if (idToken) { // we get both, we set both, but we only really care about the idToken
        // username = jwtDecode(idToken)['cognito:username']

        window.localStorage.setItem(cognitoUserPoolId, idToken)

        store.idToken = idToken

        logoutTimer = setTimeout(logout, getRemainingSessionTime(idToken))

        setCredentials()

        resolve(idToken)
      }
    } catch (error) {
      reject(error)
    }
  })
}
Gets triggered by the callback from the cognito user pool. Pretty much all it does is grab and store the idToken.