diff --git a/addressbook/backends/webdav/e-book-backend-webdav.c b/addressbook/backends/webdav/e-book-backend-webdav.c
index e9b081c..3b87268 100644
--- a/addressbook/backends/webdav/e-book-backend-webdav.c
+++ b/addressbook/backends/webdav/e-book-backend-webdav.c
@@ -651,6 +651,7 @@ download_contacts(EBookBackendWebdav *webdav, EFlag *running,
 	status  = message->status_code;
 
 	if (status == 401 || status == 407) {
+		printf ("%s: auth request...\n", __FUNCTION__);
 		GNOME_Evolution_Addressbook_CallStatus res
 			= e_book_backend_handle_auth_request(webdav);
 		g_object_unref(message);
@@ -683,6 +684,7 @@ download_contacts(EBookBackendWebdav *webdav, EFlag *running,
 		++count;
 	}
 
+	printf ("%s: found: %d elems\n", __FUNCTION__, count);
 	/* download contacts */
 	i = 0;
 	for (element = elements; element != NULL; element = element->next, ++i) {
@@ -692,8 +694,10 @@ download_contacts(EBookBackendWebdav *webdav, EFlag *running,
 		gchar *complete_uri;
 
 		/* stop downloading if search was aborted */
-		if (running != NULL && !e_flag_is_set(running))
+		if (running != NULL && !e_flag_is_set(running)) {
+			printf ("   early end\n");
 			break;
+		}
 
 		if (book_view != NULL) {
 			gfloat percent = 100.0 / count * i;
@@ -704,8 +708,10 @@ download_contacts(EBookBackendWebdav *webdav, EFlag *running,
 
 		/* skip collections */
 		uri = (const gchar *) element->href;
-		if (uri[strlen(uri)-1] == '/')
+		if (uri[strlen(uri)-1] == '/') {
+			printf ("   bad href '%s'\n", uri);
 			continue;
+		}
 
 		/* uri might be relative, construct complete one */
 		if (uri[0] == '/') {
@@ -732,7 +738,10 @@ download_contacts(EBookBackendWebdav *webdav, EFlag *running,
 		}
 
 		if (contact != NULL && book_view != NULL) {
+			printf ("%s: notifying contact %p\n", __FUNCTION__, contact);
 			e_data_book_view_notify_update(book_view, contact);
+		} else {
+			printf ("%s: no contact to notify? c:%p bv:%p\n", __FUNCTION__, contact, book_view);
 		}
 
 		g_free(complete_uri);
@@ -767,12 +776,14 @@ book_view_thread(gpointer data)
 	 * it's stopped */
 	e_data_book_view_ref(book_view);
 
+	printf ("%s: webdav\n", __FUNCTION__);
 	status = download_contacts(webdav, closure->running, book_view);
 
-	e_data_book_view_unref(book_view);
-
 	/* report back status if query wasn't aborted */
 	e_data_book_view_notify_complete(book_view, status);
+
+	e_data_book_view_unref(book_view);
+
 	return NULL;
 }
 
@@ -783,6 +794,8 @@ e_book_backend_webdav_start_book_view(EBookBackend *backend,
 	EBookBackendWebdav        *webdav = E_BOOK_BACKEND_WEBDAV(backend);
 	EBookBackendWebdavPrivate *priv   = webdav->priv;
 
+	printf ("%s: remote:%d\n", __FUNCTION__, priv->mode == GNOME_Evolution_Addressbook_MODE_REMOTE?1:0);
+
 	if (priv->mode == GNOME_Evolution_Addressbook_MODE_REMOTE) {
 		WebdavBackendSearchClosure *closure
 			= init_closure(book_view, E_BOOK_BACKEND_WEBDAV(backend));
@@ -796,8 +809,10 @@ e_book_backend_webdav_start_book_view(EBookBackend *backend,
 		GList *contacts = e_book_backend_cache_get_contacts(priv->cache, query);
 		GList *l;
 
+		printf ("%s: offline, found %d\n", __FUNCTION__, g_list_length (contacts));
 		for (l = contacts; l != NULL; l = g_list_next(l)) {
 			EContact *contact = l->data;
+			printf ("%s: notify new %p\n", __FUNCTION__, contact);
 			e_data_book_view_notify_update(book_view, contact);
 			g_object_unref(contact);
 		}
diff --git a/calendar/backends/contacts/e-cal-backend-contacts.c b/calendar/backends/contacts/e-cal-backend-contacts.c
index 49c09a5..bf2d43f 100644
--- a/calendar/backends/contacts/e-cal-backend-contacts.c
+++ b/calendar/backends/contacts/e-cal-backend-contacts.c
@@ -38,6 +38,8 @@
 #include <libecal/e-cal-util.h>
 #include <libedata-cal/e-cal-backend-util.h>
 #include <libedata-cal/e-cal-backend-sexp.h>
+#include <libedataserverui/e-passwords.h>
+#include "libedataserver/e-url.h"
 
 #include <libebook/e-book.h>
 
@@ -107,6 +109,66 @@ static void contacts_removed_cb (EBookView *book_view, const GList *contact_ids,
 static ECalBackendSyncStatus e_cal_backend_contacts_add_timezone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj);
 static void setup_alarm (ECalBackendContacts *cbc, ECalComponent *comp);
 
+static gchar *
+remove_parameters_from_uri (const gchar *uri)
+{
+	gchar *euri_str;
+	EUri *euri;
+
+	euri = e_uri_new (uri);
+	euri_str = e_uri_to_string (euri, FALSE);
+	e_uri_free (euri);
+
+	return euri_str;
+}
+
+static void
+auth_required_cb (EBook *book, gpointer data)
+{
+	ESource *source;
+	const gchar *auth;
+	const gchar *auth_domain;
+	const gchar *component_name;
+	const gchar *uri;
+	const gchar *user;
+	gchar *password;
+        gchar *stripped_uri;
+
+	g_return_if_fail (book != NULL);
+	g_return_if_fail (E_IS_BOOK (book));
+
+	source = e_book_get_source (book);
+	uri = e_book_get_uri (book);
+        stripped_uri = remove_parameters_from_uri (uri);
+	auth_domain = e_source_get_property (source, "auth-domain");
+
+	component_name = auth_domain ? auth_domain : "Addressbook";
+	uri = stripped_uri;
+
+	password = e_passwords_get_password (component_name, uri);
+
+	auth = e_source_get_property (source, "auth");
+	if (auth && !strcmp ("ldap/simple-binddn", auth)) {
+		user = e_source_get_property (source, "binddn");
+	} else if (auth && !strcmp ("plain/password", auth)) {
+		user = e_source_get_property (source, "user");
+		if (!user) {
+			user = e_source_get_property (source, "username");
+		}
+	} else {
+		user = e_source_get_property (source, "email_addr");
+	}
+
+	if (!user)
+		user = "";
+
+	if (password)
+		e_book_authenticate_user (book, user, password, auth, NULL);
+
+	g_free (stripped_uri);
+	g_free (password);
+}
+
 /* BookRecord methods */
 static BookRecord *
 book_record_new (ECalBackendContacts *cbc, ESource *source)
@@ -118,26 +180,38 @@ book_record_new (ECalBackendContacts *cbc, ESource *source)
         BookRecord *br;
 	GError     *error = NULL;
 
+	printf ("%s: opening '%s'\n", __FUNCTION__, e_source_peek_name (source));
 	book = e_book_new (source, NULL);
+	if (book)
+		g_signal_connect (book, "auth_required", (GCallback) auth_required_cb, NULL);
+
         if (!book || !e_book_open (book, TRUE, &error) || error) {
 		g_object_unref (book);
-		if (error) {
-			g_warning ("%s: Failed to open book, error: %s", G_STRFUNC, error->message);
+
+		g_warning ("%s: Failed to open book, error: %s", G_STRFUNC, error ? error->message : "Unknown error");
+		if (error)
 			g_error_free (error);
-		}
+
 		return NULL;
 	}
 
+	g_signal_handlers_disconnect_by_func (book, auth_required_cb, NULL);
+
         /* Create book view */
         fields = g_list_append (fields, (gchar *)e_contact_field_name (E_CONTACT_FILE_AS));
         fields = g_list_append (fields, (gchar *)e_contact_field_name (E_CONTACT_BIRTH_DATE));
         fields = g_list_append (fields, (gchar *)e_contact_field_name (E_CONTACT_ANNIVERSARY));
         query = e_book_query_any_field_contains ("");
 
-        if (!e_book_get_book_view (book, query, fields, -1, &book_view, NULL)) {
+        if (!e_book_get_book_view (book, query, fields, -1, &book_view, &error) || error) {
                 e_book_query_unref (query);
                 g_object_unref (book);
                 g_list_free (fields);
+		
+		g_warning ("%s: Failed to get book view, error: %s", G_STRFUNC, error ? error->message : "Unknown error");
+		if (error)
+			g_error_free (error);
+
                 return NULL;
         }
         e_book_query_unref (query);
@@ -196,6 +270,7 @@ contact_record_new (ECalBackendContacts *cbc, EBook *book, EContact *contact)
 		comp_str = e_cal_component_get_as_string (cr->comp_birthday);
 		e_cal_backend_notify_object_created (E_CAL_BACKEND (cbc),
 						     comp_str);
+		printf ("%s: notify new created: '---%s---'\n\n", __FUNCTION__, comp_str);
 		g_free (comp_str);
 	}
 
@@ -460,6 +535,8 @@ contacts_added_cb (EBookView *book_view, const GList *contacts, gpointer user_da
                 birthday = e_contact_get (contact, E_CONTACT_BIRTH_DATE);
                 anniversary = e_contact_get (contact, E_CONTACT_ANNIVERSARY);
 
+		printf ("%s: found b:%p a:%p ---%s---\n\n", __FUNCTION__, birthday, anniversary, e_vcard_to_string (contact, EVC_FORMAT_VCARD_30));
+
                 if (birthday || anniversary) {
                         ContactRecord *cr = contact_record_new (cbc, book, contact);
                         const gchar    *uid = e_contact_get_const (contact, E_CONTACT_UID);
