tarickb / sasl-xoauth2

SASL plugin for XOAUTH2
Other
73 stars 21 forks source link

The sasl-xoauth2-tool tool does not send the secret to the Microsoft endpoint. #62

Closed krzsztf1 closed 1 year ago

krzsztf1 commented 1 year ago

As a result, when requesting initial tokens, a "HTTP Error 401: Unauhorized" error is returned because "The request body must contain the following parameter: 'client_assertion' or 'client_secret'".

Traceback (most recent call last): File "/usr/bin/sasl-xoauth2-tool", line 301, in main() File "/usr/bin/sasl-xoauth2-tool", line 294, in main args.func(args) File "/usr/bin/sasl-xoauth2-tool", line 197, in subcommand_get_token get_token_outlook( File "/usr/bin/sasl-xoauth2-tool", line 183, in get_token_outlook tokens = outlook_get_initial_tokens(client_id, tenant, code) File "/usr/bin/sasl-xoauth2-tool", line 163, in outlook_get_initial_tokens resp = urllib.request.urlopen( File "/usr/lib/python3.10/urllib/request.py", line 216, in urlopen return opener.open(url, data, timeout) File "/usr/lib/python3.10/urllib/request.py", line 525, in open response = meth(req, response) File "/usr/lib/python3.10/urllib/request.py", line 634, in http_response response = self.parent.error( File "/usr/lib/python3.10/urllib/request.py", line 563, in error return self._call_chain(args) File "/usr/lib/python3.10/urllib/request.py", line 496, in _call_chain result = func(args) File "/usr/lib/python3.10/urllib/request.py", line 643, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 401: Unauthorized

KodakMaciel commented 1 year ago

@krzsztf1 Hello, I tested your change and managed to ask for the secret token, but now the access_token is thrown on my screen and is not saved anywhere, can you tell me where it should be saved and what the syntax of the content inside the file should be ?

tarickb commented 1 year ago

The token tool will write the resulting access token to a file if you specify a path on the command line. See the example usage here (look for PATH_TO_TOKENS_FILE).