Example #1
0
  },

  onTwitterLogin(response) {
    const { router } = this.context;

    // Create the authData object
    const authData = {
      authData: {
        'auth_token'        : response.oauth_token,
        'auth_token_secret' : response.oauth_token_secret,
        'id'                : response.user_id,
        'screen_name'       : response.screen_name
      }
    }

    Parse.User
      .logInWith('twitter', authData)
      .then(
        this.onLoginSuccess,
        this.onLoginFailure
      );
  },

  onLoginSuccess() {
    // Force load from root, for context refresh
    window.location.href = "/";
  },

  onLoginFailure(error) {
    this.error(error);
  },