summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorhc <haocheng.xie@respiree.com>2026-02-13 11:49:19 +0800
committerhc <haocheng.xie@respiree.com>2026-02-13 11:49:19 +0800
commit437cbb190787281c4be6a86014b6adaff8caef34 (patch)
tree18c587982eb9d92de48c13b6e73348661660f02c /docs
Diffstat (limited to 'docs')
-rw-r--r--docs45
1 files changed, 45 insertions, 0 deletions
diff --git a/docs b/docs
new file mode 100644
index 0000000..5193438
--- /dev/null
+++ b/docs
@@ -0,0 +1,45 @@
1
2az login
3az account show --query tenantDefaultDomain -o tsv
4
5# Create user
6az ad user create --display-name "John Doe" --user-principal-name jdoe@publicanub.onmicrosoft.com --password "P@ssw0rd123" --mail-nickname jdoe
7az ad user list --output table
8
9# Register app (OIDC)
10az ad app create --display-name "testapp3" --web-redirect-uris "http://localhost:3000/callback" --sign-in-audience "AzureADMultipleOrgs"
11## --web-redirect-uris: where Azure AD sends auth responses after sign-in
12## --sign-in-audience: AzureADMyOrg (your tenant only) | AzureADMultipleOrgs (any tenant) | AzureADandPersonalMicrosoftAccount (any tenant + personal outlook/hotmail)
13az ad app list --display-name "testapp3" --output table
14
15# Update existing app to allow all tenants
16az ad app update --id <app-id> --sign-in-audience AzureADMultipleOrgs
17## can restrict to specific tenants by checking tid in your app code
18az ad app update --id ec014b23-edde-4a09-9a41-36bff5630829 --sign-in-audience AzureADMultipleOrgs
19
20# Create client secret (save the password from output)
21az ad app credential reset --id <app-id> --append
22az ad app credential reset --id ec014b23-edde-4a09-9a41-36bff5630829 --append
23{
24 "appId": "ec014b23-edde-4a09-9a41-36bff5630829",
25 "password": "Y.Q8Q~HuoEbCsICK18eG4oAtqjMe5eGyWSilLaZI",
26 "tenant": "23c95e59-28bd-472a-bbd4-4e310dd8f031"
27}
28
29
30# instructions for demo
31npm i
32npm start
33# go to
34localhost:3000
35# click on "Sign In with Azure AD", verify, follow the link, and put the created user's name and password into microsoft's login page
36it should redirect back to localhost:3000 wiht a success
37
38
39# how the app works
40the login redirects to microsoft-hosted login page for the appid
41after login, microsoft redirects back to localhost with an authorization code (not tokens directly)
42the server exchanges that code + client secret for jwt tokens via a server-to-server call (so tokens never pass through the browser)
43(the code alone is useless without the client secret, so intercepting it doesn't help)
44the server then verifies the jwt signature with microsoft's public keys from "https://login.microsoftonline.com/common/discovery/v2.0/keys"
45