how to redirect user login from other server?
On the Drupal side, create a custom module to implement hook_form_alter() and use it to attach a custom #submit handler to the user_login_form. In the custom submit handler, you can redirect the user to the headless DrupalGap web app:

/**
 * Implements hook_form_alter().
 */
function example_form_alter(&amp;$form, $form_state, $form_id) {
  if ($form_id == 'user_login_form' &amp;&amp; arg(0) == 'drupalgap') {
    $form['#submit'][] = 'example_user_login_form_submit';
  }
}

function example_user_login_form_submit($form, &amp;$form_state) {
  $uid = 123; // This id will be somewhere in the $form or $form_state object.
  drupal_goto('https://example.com/#user_' . $uid);
}


Replace drupalgap with your service endpoint path, but by default it is drupalgap.