Created
June 15, 2023 21:15
-
-
Save tarickb/b3f23f3066fc94cd0e9edcc0ed14a9a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/sasl-xoauth2-tool 2023-06-15 14:08:02.401417072 -0700 | |
+++ b/sasl-xoauth2-tool 2023-06-15 14:14:17.865592289 -0700 | |
@@ -155,12 +155,12 @@ | |
url = f"https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token" | |
token_request:Dict[str,str] = {} | |
token_request['client_id'] = client_id | |
- token_request['client_secret'] = client_secret | |
+ if len(client_secret) > 0: | |
+ token_request['client_secret'] = client_secret | |
token_request['scope'] = OUTLOOK_SCOPE | |
token_request['code'] = code | |
token_request['redirect_uri'] = OUTLOOK_REDIRECT_URI | |
token_request['grant_type'] = 'authorization_code' | |
- | |
resp = urllib.request.urlopen( | |
urllib.request.Request( | |
url, | |
@@ -198,8 +198,6 @@ | |
def subcommand_get_token(args:argparse.Namespace) -> None: | |
if not args.client_secret: | |
args.client_secret = input('Please enter OAuth2 client secret: ') | |
- if not args.client_secret: | |
- parser.error("fetching initial token requires 'client-secret' argument.") | |
if args.service == 'outlook': | |
if not args.tenant: | |
parser.error("'outlook' service requires 'tenant' argument.") | |
@@ -210,6 +208,8 @@ | |
args.output_file, | |
) | |
elif args.service == 'gmail': | |
+ if not args.client_secret: | |
+ parser.error("'gmail' service requires 'client-secret' argument.") | |
if not args.scope: | |
parser.error("'gmail' service requires 'scope' argument.") | |
get_token_gmail( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment