Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Addressing PR comments
  • Loading branch information
abhidnya13 committed Oct 25, 2019
commit 381ab1bb5f0e65a0539918a82bd4114986e76af5
4 changes: 2 additions & 2 deletions sample/confidential_client_certificate_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The configuration file would look like this (sans those // comments):

{
"authority": "https://login.microsoftonline.com/organizations",
"authority": "https://login.microsoftonline.com/Enter_the_Tenant_Name_Here",
"client_id": "your_client_id",
"scope": ["https://graph.microsoft.com/.default"],
// For more information about scopes for an app, refer:
Expand Down Expand Up @@ -60,7 +60,7 @@
graph_data = requests.get( # Use token to call downstream service
config["endpoint"],
headers={'Authorization': 'Bearer ' + result['access_token']}, ).json()
print("Users from graph: " + str(graph_data))
print("Graph API call result: " + str(graph_data))
else:
print(result.get("error"))
print(result.get("error_description"))
Expand Down
11 changes: 6 additions & 5 deletions sample/confidential_client_secret_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
The configuration file would look like this (sans those // comments):

{
"authority": "https://login.microsoftonline.com/organizations",
"authority": "https://login.microsoftonline.com/Enter_the_Tenant_Name_Here",
"client_id": "your_client_id",
"scope": ["https://graph.microsoft.com/.default"],
// For more information about scopes for an app, refer:
// https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow#second-case-access-token-request-with-a-certificate"

"secret": "The secret generated by AAD during your confidential app registration"
"secret": "The secret generated by AAD during your confidential app registration",
// For information about generating client secret, refer:
// https://github.com/AzureAD/microsoft-authentication-library-for-python/wiki/Client-Credentials#registering-client-secrets-using-the-application-registration-portal

Expand Down Expand Up @@ -58,9 +58,10 @@
if "access_token" in result:
# Calling graph using the access token
graph_data = requests.get( # Use token to call downstream service
"https://graph.microsoft.com/v1.0/users",
headers={'Authorization': 'Bearer ' + result['access_token']},).json()
print("Users from graph: " + str(graph_data))
config["endpoint"],
headers={'Authorization': 'Bearer ' + result['access_token']}, ).json()
print("Graph API call result: " + str(graph_data))

else:
print(result.get("error"))
print(result.get("error_description"))
Expand Down