From 6a6c7117dee91c9fd11c2b30f34f70386f1fba21 Mon Sep 17 00:00:00 2001
From: Dino Macri <36100525+dinomacri@users.noreply.github.com>
Date: Fri, 20 Jul 2018 19:27:51 +0930
Subject: calcurse-caldav: fix basic authentication

Read whether basic authentication is used and add the credentials to
httplib2 when making a request.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
---
 contrib/caldav/calcurse-caldav.py | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'contrib')

diff --git a/contrib/caldav/calcurse-caldav.py b/contrib/caldav/calcurse-caldav.py
index 39409d6..2c5757e 100755
--- a/contrib/caldav/calcurse-caldav.py
+++ b/contrib/caldav/calcurse-caldav.py
@@ -656,6 +656,11 @@ try:
         # Authenticate with OAuth2 and authorize HTTP object
         cred = run_auth(authcode)
         conn = cred.authorize(conn)
+
+    # Add credentials to httplib2 to be used when request requires authentication
+    if authmethod == 'basic':
+        conn.add_credentials(username, password)
+
     elif authmethod != 'basic':
         die('Invalid option for AuthMethod in config file. Use "basic" or "oauth2"')
 
-- 
cgit v1.2.3-70-g09d2