Custom Entra ID provider: Entra reports sign-in success, but no POST ever reaches /.auth/login/aad/callback
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 42/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- azure, react, vite
- Lĩnh vực
- authentication, cloud
Hướng nghiên cứu
Bắt đầu với staticwebapp.config.json và tái hiện chuỗi chuyển hướng từ /.auth/login/aad đến Entra authorize endpoint, đồng thời giữ nguyên nhật ký mạng của trình duyệt. So sánh luồng của provider tùy chỉnh với provider được cấu hình sẵn đang hoạt động và điều tra lý do /.auth/login/aad/callback không nhận được POST nào. Hoàn tất khi callback thiết lập được một session hoặc runtime cung cấp thông tin chẩn đoán có thể xử lý cho lỗi này.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Custom Entra ID provider: Entra reports sign-in success, but no POST ever reaches /.auth/login/aad/callback
Summary
On a Standard plan Static Web App with a custom Microsoft Entra ID provider,
interactive sign-in never completes. The user authenticates successfully at
Microsoft — Entra's own Sign-in Diagnostic confirms first factor and MFA both
satisfied, with no Conditional Access interruption — but the browser never issues
the form_post back to /.auth/login/aad/callback, and the user is shown
"We couldn't sign you in. Please try again."
The same site works correctly with the pre-configured Entra provider
(/.auth/login/aad without an auth block), using role invitations. Only the
custom registration path fails.
Environment
| Plan | Standard |
| Region | Global (no managed Functions API) |
| Deployment | SWA CLI 2.0.10, swa deploy ./dist --env production |
| App | static SPA (React 18 / Vite), no API |
| Browsers | Edge 150, Chrome — identical behaviour in both, and in private windows |
Configuration
staticwebapp.config.json (deployed at the root of the output folder; verified
consumed, not served — requesting it does not return the JSON):
{
"auth": {
"identityProviders": {
"azureActiveDirectory": {
"registration": {
"openIdIssuer": "https://login.microsoftonline.com/<TENANT_ID>/v2.0",
"clientIdSettingName": "AZURE_CLIENT_ID",
"clientSecretSettingName": "AZURE_CLIENT_SECRET"
}
}
}
},
"routes": [
{ "route": "/.auth/*", "allowedRoles": ["anonymous"] },
{ "route": "/no-access.html", "allowedRoles": ["anonymous"] },
{ "route": "/logout", "redirect": "/.auth/logout" },
{ "route": "/*", "allowedRoles": ["authenticated"] }
],
"responseOverrides": {
"401": { "statusCode": 302, "redirect": "/.auth/login/aad?post_login_redirect_uri=.referrer" },
"403": { "rewrite": "/no-access.html" }
},
"navigationFallback": {
"rewrite": "/index.html",
"exclude": ["/.auth/*", "/assets/*", "/no-access.html"]
}
}
Application settings on the Production environment: AZURE_CLIENT_ID,
AZURE_CLIENT_SECRET.
App registration: single tenant; Web platform with redirect URI
https://<app>.azurestaticapps.net/.auth/login/aad/callback; ID tokens
enabled under Implicit grant and hybrid flows; User.Read delegated with admin
consent granted.
Observed behaviour
GET /→302→/.auth/login/aad?post_login_redirect_uri=/- →
302→ same path withstaticWebAppsAuthNonce - →
302→https://login.microsoftonline.com/<TENANT_ID>/oauth2/v2.0/authorize?...
withresponse_type=code+id_token,response_mode=form_post,
redirect_uri=https%3A%2F%2F<app>.azurestaticapps.net%2F.auth%2Flogin%2Faad%2Fcallback - User signs in; MFA completes
- No POST to
/.auth/login/aad/callbackappears in the browser network trace
(DevTools, Preserve log enabled, full session captured) - Browser shows "We couldn't sign you in. Please try again."
What Entra reports
Sign-in Diagnostic, correlation ID 8b81b7fa-a6af-4178-8a59-d095c23de49c,
2026-08-01T13:37:09Z:
Based on the information you provided the user … signed into
. No Conditional Access policies interrupted or blocked the sign-in.
| Date | Auth method | Result |
|---|---|---|
| 2026-08-01T13:37:09Z | Previously satisfied | First factor requirement satisfied by claim in the token |
| 2026-08-01T13:37:09Z | Previously satisfied | MFA requirement satisfied by claim in the token |
Sign-in logs → Service principal sign-ins contains no entries for this
application — consistent with the authorization code never being redeemed.
Ruled out, each verified individually
- ID tokens enabled (its absence produced a different, distinguishable
symptom: an endless MFA loop) - Assignment required set to
No; also tested with the user explicitly assigned - Admin consent granted for the delegated permission
- Web redirect URI present and byte-exact against the
redirect_uriobserved
on the wire - Client secret — every secret deleted and a single fresh one issued, pasted
directly into the Production application setting - Both issuer forms —
https://login.microsoftonline.com/<TENANT_ID>/v2.0,
and the version-1 formhttps://login.microsoftonline.com/<TENANT_ID>with
userDetailsClaim. Verified by measurement that this changes the endpoint
called (/oauth2/v2.0/authorizevs/oauth2/authorize). Neither completes - Browser — Edge and Chrome, normal and private windows, cookies allowed,
tracking prevention lowered - Route configuration —
/.auth/*allowed anonymously and excluded from
navigationFallback; the config is confirmed consumed rather than served
Expected vs actual
Expected: after authentication, Microsoft posts code/id_token to
/.auth/login/aad/callback; the runtime redeems the code and establishes a
session.
Actual: authentication succeeds at Entra, the POST never occurs, and the
runtime reports a generic failure with no diagnostic surface — no error code, and
nothing in the tenant's sign-in logs indicating a refusal.
Questions
- Is there any way to obtain diagnostics from the Static Web Apps auth runtime
for a failed custom-provider sign-in? The single generic message with no code
makes this undiagnosable from the customer side. - Is
response_type=code+id_tokenwithresponse_mode=form_postexpected
against a/v2.0issuer, and does anything about that combination require
configuration beyond the documented sample?
Workaround
Reverted to the pre-configured provider with role invitations, which works
reliably. That costs tenant restriction — the only reason the Standard plan was
purchased.
Tenant, client and host identifiers redacted; available privately. The
correlation ID above is sufficient to locate the sign-in event.
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 347
- Fork
- 68
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Azure/static-web-apps
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Azure/static-web-apps#1764 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Azure/static-web-apps#1827 ·
-
Managed Functions Not RestartingĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Azure/static-web-apps#1826 · 5 bình luận · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
Azure/static-web-apps#1825 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 18/100
Azure/static-web-apps#1824 ·
Tất cả issue của Azure/static-web-apps
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 69/100
StevenBlack/hosts#3314 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Security sweep findingsĐang mởsecurity-sweep
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100