Skip to content

Commit

Permalink
Fix MSGraph UsernamePassword Authentication (#497)
Browse files Browse the repository at this point in the history
parsedmarc/pull/471 broke UsernamePassword authentication for me. This change fixes it.

Co-authored-by: Tim Nowaczyk <[email protected]>
  • Loading branch information
zimage and Tim Nowaczyk authored Mar 26, 2024
1 parent 18f7508 commit d907dd8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions parsedmarc/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,11 @@ def process_reports(reports_):
else:
logger.critical("password setting missing from the "
"msgraph config section")
if "client_secret" in graph_config:
opts.graph_client_secret = graph_config["client_secret"]
else:
logger.critical("client_secret setting missing from the "
"msgraph config section")
exit(-1)

if opts.graph_auth_method == AuthMethod.DeviceCode.name:
Expand Down
1 change: 1 addition & 0 deletions parsedmarc/mail/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def _generate_credential(auth_method: str, token_path: Path, **kwargs):
elif auth_method == AuthMethod.UsernamePassword.name:
credential = UsernamePasswordCredential(
client_id=kwargs['client_id'],
client_credential=kwargs['client_secret'],
disable_automatic_authentication=True,
username=kwargs['username'],
password=kwargs['password'],
Expand Down

0 comments on commit d907dd8

Please sign in to comment.