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>
This commit is contained in:
Dino Macri 2018-07-20 19:27:51 +09:30 committed by Lukas Fleischer
parent 61dc7ab538
commit 6a6c7117de

View File

@ -656,6 +656,11 @@ try:
# Authenticate with OAuth2 and authorize HTTP object # Authenticate with OAuth2 and authorize HTTP object
cred = run_auth(authcode) cred = run_auth(authcode)
conn = cred.authorize(conn) 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': elif authmethod != 'basic':
die('Invalid option for AuthMethod in config file. Use "basic" or "oauth2"') die('Invalid option for AuthMethod in config file. Use "basic" or "oauth2"')