Member login URL 'too many' redirects

Discussion in 'aMember Pro v.4' started by ndesign, Jun 21, 2013.

  1. ndesign

    ndesign New Member

    Joined:
    Jun 24, 2010
    Messages:
    2
    We have an update system in our themes that allow the user to login from the theme settings whenever an update is available and automatically download and apply it. This was the code we used in aMember 3

    $response = wp_remote_post(
    'http://oursite.com/amember/login.php',
    array(
    'timeout' => 300,
    'headers' => array(),
    'body' => array(
    'amember_login' => $_POST['username'],
    'amember_pass' => $_POST['password']
    )
    )
    );

    if( is_wp_error( $response ) ) {
    echo 'Error ' . $response->get_error_code() . ': ' . $response->get_error_message($response->get_error_code());
    die();
    }

    This was inside a function called by ajax. After a successful request, if there was no error, we set up the amember_nr cookie.

    However, the same code against aMember 4 is throwing a failed http request due to too many redirects. This is the code we use

    $response = wp_remote_post(
    'http://oursite.com/amember/login',
    array(
    'timeout' => 300,
    'headers' => array(),
    'body' => array(
    'amember_login' => $_POST['username'],
    'amember_pass' => $_POST['password']
    )
    )
    );

    which is basically the same, excepting for the URL to our stage which is in a different directory. Now, we have tried http://oursite.com/amember/login and http://oursite.com/amember/login.php and http://oursite.com/amember/ and every url throws too many redirects.

    Do you have any idea where the "too many redirects" are originating? Since now aMember4 doesn't have an actual login.php file, what physical URL should we use to avoid 'too many redirects'?
  2. thehpmc

    thehpmc Member

    Joined:
    Aug 24, 2006
    Messages:
    901
    This is normally because you are redirecting to one place which then directs back to original or on through a chain that leads back to the first.

    So you enter a loop and eventually receive this error.
  3. ndesign

    ndesign New Member

    Joined:
    Jun 24, 2010
    Messages:
    2
    Is there a direct login URL where there is no redirection?

Share This Page