Skip to content

Document showing apps in Microsoft Teams - #223

Draft
tnkuehne wants to merge 2 commits into
mainfrom
docs/embedded-app-sign-in
Draft

tnkuehne wants to merge 2 commits into
mainfrom
docs/embedded-app-sign-in

Conversation

@tnkuehne

Copy link
Copy Markdown
Contributor

Documents #222.

  • New guide Show apps in Microsoft Teams: prepare the Entra registration for Teams single sign-on, allow the embedding hosts, answer Widefleet's sign-in requests from the tab, check the result and troubleshoot.
  • Company sign-in settings reference: embeddingOrigins.

Publication is blocked until a published release contains #222. Based on feat/embedded-app-sign-in, so this diff contains only documentation.

blume validate and the docs build pass.

Pages such as a Microsoft Teams tab can now show published apps in a
frame. The provider's sign-in page refuses to render in frames and the
regular Lax session cookie is not sent there, so a framed navigation
without a session goes to a sign-in page on the auth host instead. That
page asks its embedding page for a host token through postMessage, and
the proxy verifies it against the organization's Entra client and
tenant, resolves groups through on-behalf-of Graph access and issues a
partitioned session that expires with the token.

Organizations list the hosts that may embed their apps in their
settings. The list becomes the apps' frame-ancestors and is published
only for Entra app identity.
Explain how administrators allow embedding hosts and how a Teams tab answers Widefleet's sign-in requests with its Microsoft token.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
widefleet-docs 3c8ce09 Nov 18 2026, 11:57 PM

tnkuehne added a commit that referenced this pull request Nov 19, 2026
## Problem

Organizations want to show published apps inside pages their colleagues
already use, such as a Microsoft Teams tab or a company portal. Today an
app cannot be framed by another site, and company sign-in does not work
in a frame:

- App responses send `frame-ancestors 'self'`.
- Identity providers refuse to render their sign-in pages in frames.
- The app session cookie is `SameSite=Lax`, so a cross-site frame never
sends it.

## Changes

**Settings.** Organizations list the page origins that may embed their
apps (`embeddingOrigins`, HTTPS origins with optional `*.` subdomain
wildcard). This works through the settings UI (new **Embedded apps**
section for Entra connections) and the existing settings API and CLI
export/apply. An input that omits the field keeps the saved list, so
older settings files do not clear it. The list is published with the app
sign-in configuration only for Entra app identity, and removing SSO
clears it.

**Frame ancestors.** The auth proxy passes the organization's list to
the runtime, which adds it to each app response's `frame-ancestors`. App
code cannot change it.

**Embedded sign-in.** A framed HTML navigation without a session
(`Sec-Fetch-Dest: iframe`) goes to `/oauth2/ORG/embedded` on the auth
host instead of the provider:

1. The page asks its parent for a host token
(`widefleet:host-token-request`) and accepts the answer only from a
configured origin. Tokens are exchanged with the auth host only, never
with the app frame.
2. The proxy verifies the token as an Entra v2 delegated access token
for the organization's app sign-in client and tenant. Its audience is
the same client that signs users in to apps, so it proves the same
identity as a regular sign-in.
3. It resolves groups with an on-behalf-of Microsoft Graph token,
reusing the existing nested group lookup. Apps receive the same user ID
(`oid`), and app access rules apply unchanged.
4. It issues a separate `HttpOnly; Secure; SameSite=None; Partitioned`
session cookie that expires with the host token. The cookie exists only
under the embedding top-level site and holds no refresh credential.
After expiry, the next framed navigation asks the host again, so access
is rechecked with every new token.
5. Before returning to the app, the page confirms that the browser kept
the session. If it did not, the page offers to open the app in a new tab
instead of looping.

Sign-out also clears the embedded session. `docs/architecture.md`
records the boundary.

## Screens

Settings and the embedded sign-in page with synthetic fixtures, rendered
from the merge base (`4dbf4aa0`) and from this branch at 1280 and 390
px.

### Company sign-in settings

Before, the page has no embedding section. After, Entra connections show
**Embedded apps** below the email domains, and the removal text mentions
embedding hosts.

| | Before | After |
|---|---|---|
| light, 1280 px | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/before-sso-domains-light-1280.png"
alt="Before, light, 1280 px" width="380"> | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-sso-domains-light-1280.png"
alt="After, light, 1280 px" width="380"> |
| light, 390 px | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/before-sso-domains-light-390.png"
alt="Before, light, 390 px" width="170"> | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-sso-domains-light-390.png"
alt="After, light, 390 px" width="170"> |
| dark, 1280 px | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/before-sso-domains-dark-1280.png"
alt="Before, dark, 1280 px" width="380"> | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-sso-domains-dark-1280.png"
alt="After, dark, 1280 px" width="380"> |
| dark, 390 px | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/before-sso-domains-dark-390.png"
alt="Before, dark, 390 px" width="170"> | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-sso-domains-dark-390.png"
alt="After, dark, 390 px" width="170"> |

### Embedding hosts

A saved host, and the Add host dialog rejecting an HTTP origin.

| | Saved host | Invalid origin |
|---|---|---|
| light, 1280 px | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-sso-embedding-light-1280.png"
alt="Saved host, light, 1280 px" width="380"> | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-sso-embedding-dialog-light-1280.png"
alt="Invalid origin, light, 1280 px" width="380"> |
| light, 390 px | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-sso-embedding-light-390.png"
alt="Saved host, light, 390 px" width="170"> | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-sso-embedding-dialog-light-390.png"
alt="Invalid origin, light, 390 px" width="170"> |
| dark, 1280 px | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-sso-embedding-dark-1280.png"
alt="Saved host, dark, 1280 px" width="380"> | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-sso-embedding-dialog-dark-1280.png"
alt="Invalid origin, dark, 1280 px" width="380"> |
| dark, 390 px | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-sso-embedding-dark-390.png"
alt="Saved host, dark, 390 px" width="170"> | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-sso-embedding-dialog-dark-390.png"
alt="Invalid origin, dark, 390 px" width="170"> |

### Embedded sign-in page (new)

Shown in a frame of `https://portal.example.test`: waiting for the host,
the host reporting that it has no token, and missing admin consent.

| | Signing in | No host token | Consent required |
|---|---|---|---|
| light, 1280 px | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-embedded-signing-in-light-1280.png"
alt="Signing in, light, 1280 px" width="260"> | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-embedded-unsupported-light-1280.png"
alt="No host token, light, 1280 px" width="260"> | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-embedded-consent-light-1280.png"
alt="Consent required, light, 1280 px" width="260"> |
| light, 390 px | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-embedded-signing-in-light-390.png"
alt="Signing in, light, 390 px" width="120"> | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-embedded-unsupported-light-390.png"
alt="No host token, light, 390 px" width="120"> | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-embedded-consent-light-390.png"
alt="Consent required, light, 390 px" width="120"> |
| dark, 1280 px | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-embedded-signing-in-dark-1280.png"
alt="Signing in, dark, 1280 px" width="260"> | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-embedded-unsupported-dark-1280.png"
alt="No host token, dark, 1280 px" width="260"> | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-embedded-consent-dark-1280.png"
alt="Consent required, dark, 1280 px" width="260"> |
| dark, 390 px | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-embedded-signing-in-dark-390.png"
alt="Signing in, dark, 390 px" width="120"> | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-embedded-unsupported-dark-390.png"
alt="No host token, dark, 390 px" width="120"> | <img
src="https://gist.githubusercontent.com/tnkuehne/0aed2a4d87718647ac85fb2c65c06462/raw/7b427b4618b5c5d00beb7d0ac48be3fb3831f613/after-embedded-consent-dark-390.png"
alt="Consent required, dark, 390 px" width="120"> |

Not shown: the 15-second timeout and the server-error state, which use
the same layout as "No host token" with the generic message.

## Verification

- `pnpm check`, full `pnpm exec vitest run` against the local test
services (1101 passed), and the self-hosted SSO Playwright spec.
- New proxy tests cover redirects for framed and top-level navigations,
rejection of unregistered destinations and organizations without
embedding, the token exchange, cookie attributes, forwarded identity,
app access rules, expiry, and rejection of tokens for another client,
another tenant, app-only or v1 tokens. They also cover the Origin and
content-type checks, consent and outage errors, and sign-out.
- A Chromium test (`RUN_EDGE_TESTS=1`) embeds an app from a cross-site
page that answers the token request. It checks the forwarded identity
and the cookie's partition key, and that a page on an unlisted site gets
no app. Without `Partitioned` the test fails.
- Settings integration test for publishing, preserving and clearing the
list. The e2e spec adds and removes a host in the UI and validates
input. I checked the screenshots at 1280 and 390 px in light and dark:
the section matches **Email domains**, the page does not scroll
horizontally, and focus returns to **Add host** after the dialog.

Not verified here: a real Teams client, and Safari. Safari supports
partitioned cookies from 26.2. Playwright's Linux WebKit does not
implement cookie partitions, so it cannot test this flow.

Documentation: #223 (draft, blocked on the release that contains this
change).










<!-- greptile_comment -->

<!-- greptile_summary -->

<h2><a
href="https://app.greptile.com/api/retrigger?id=112065034&amp;sig=31cfd749d677c796ff54c0cc4ae2022e7ea36d93367f4e84fc12cba1ec6881ba"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img
alt="Retrigger"
src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"
align="right"></picture></a><a
href="https://app.greptile.com/-/switch-tenant?tenant=mendra&amp;next=%2Fwidefleet%2Fwidefleet%2Fpull%2F222&amp;utm_source=greptile_review&amp;utm_medium=github&amp;utm_campaign=view_in_greptile"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img
alt="View in Greptile"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"
align="right"></picture></a>Confidence Score: 5/5</h2>

<!-- greptile-impact-verdict --> The PR appears safe to merge; no
blocking issues were found.

<details open><summary><h3>Summary</h3></summary>

Adds host-token sign-in for embedded Entra apps, with
organization-approved embedding sites and separate, short-lived browser
sessions.

- Embedded apps sign users in through their host instead of a provider
page.
- Admins can choose which HTTPS sites are allowed to embed their apps.
- App responses allow only the organization’s configured sites to frame
them.

No new actionable issues found.
</details>

<details open><summary><h3>Diagram</h3></summary>

```mermaid
sequenceDiagram
    participant Host as Approved host page
    participant Auth as Auth sign-in frame
    participant Entra as Microsoft Entra
    participant Graph as Microsoft Graph
    participant App as Published app
    Auth->>Host: Request host token
    Host->>Auth: Return delegated token
    Auth->>Auth: Check signature, tenant, and audience
    Auth->>Entra: Exchange token on behalf of user
    Entra-->>Auth: Graph access token
    Auth->>Graph: Read user and groups
    Graph-->>Auth: Identity and memberships
    Auth->>Auth: Set partitioned session and confirm cookie
    Auth->>App: Return to app
    App->>App: Check session and app access rules
```
</details>

<!-- greptile_confidence_score:5 -->

<sub>Reviews (4) · Last reviewed commit: ["Merge remote-tracking branch
&#39;upstream/m..."](d3e958d)
· [Reviewed by
Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub>

<!-- /greptile_comment -->
Base automatically changed from feat/embedded-app-sign-in to main November 19, 2026 09:32
@jonathanlaib jonathanlaib added the documentation Improvements or additions to documentation label Nov 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants