Skip to content

Commit

Permalink
Merge pull request #13 from CrossRealms/log-fail-access-token
Browse files Browse the repository at this point in the history
log failed to get access token
  • Loading branch information
mahirchavda authored Mar 20, 2024
2 parents 2563b08 + b49250e commit 74a8e76
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@ def get_access_token(helper, application_id, secret, tenant):
}
url = "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/token"
if sys.version_info > (3, 0):
access_token = helper.send_http_request(
resp = helper.send_http_request(
url, "POST", payload=urllib.parse.urlencode(data), timeout=(15.0, 15.0)
).json()
)
else:
access_token = helper.send_http_request(
resp = helper.send_http_request(
url, "POST", payload=urllib.urlencode(data), timeout=(15.0, 15.0)
).json()
)
if resp.status_code not in (201, 200):
helper.log_error("Failed to get access_token. status_code={}, resp={}".format(resp.status_code, resp.text))
resp.raise_for_status()
access_token = resp.json()
return access_token[ACCESS_TOKEN]


Expand Down

0 comments on commit 74a8e76

Please sign in to comment.