Skip to content

Commit 19e604b

Browse files
authored
Merge pull request #103 from Azure-Samples/use-full-authority
Switch config from tenant_id to full authority
2 parents 2e33f4f + cf0c23e commit 19e604b

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

.env.sample

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
CLIENT_ID=<client id>
55
CLIENT_SECRET=<client secret>
66

7-
# Expects a full tenant id such as "contoso.onmicrosoft.com", or its GUID
8-
# Or leave it undefined if you are building a multi-tenant app
9-
#TENANT_ID=<tenant id>
7+
# Expects a full authority URL such as "https://login.microsoftonline.com/TENANT_GUID"
8+
# or "https://login.microsoftonline.com/contoso.onmicrosoft.com".
9+
# Alternatively, leave it undefined if you are building a multi-tenant app in world-wide cloud
10+
#AUTHORITY=<authority url>

app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
auth = identity.web.Auth(
2121
session=session,
22-
authority=app.config.get("AUTHORITY"),
22+
authority=app.config["AUTHORITY"],
2323
client_id=app.config["CLIENT_ID"],
2424
client_credential=app.config["CLIENT_SECRET"],
2525
)

app_config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
# Application's generated client secret: never check this into source control!
66
CLIENT_SECRET = os.getenv("CLIENT_SECRET")
77

8-
# AUTHORITY = "https://login.microsoftonline.com/common" # For multi-tenant app
9-
AUTHORITY = f"https://login.microsoftonline.com/{os.getenv('TENANT_ID', 'common')}"
8+
# You can configure your authority via environment variable
9+
# Defaults to a multi-tenant app in world-wide cloud
10+
AUTHORITY = os.getenv("AUTHORITY", "https://login.microsoftonline.com/common")
1011

1112
REDIRECT_PATH = "/getAToken" # Used for forming an absolute URL to your redirect URI.
1213
# The absolute URL must match the redirect URI you set

0 commit comments

Comments
 (0)