Repository navigation
feat(teams): Each user signs in, so a chat agent acts as each user (1.0.0) - #4164
Merged
crazywoola merged 2 commits intoNov 2, 2026
Merged
Conversation
This was referenced Nov 1, 2026
crazywoola
approved these changes
Nov 2, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Same feature as the Outlook plugin's #4163, for Teams. Today a Teams authorization is shared: everyone using the tool posts and reads as the one person who signed in from the console. For a chat agent that many people use ("what's new in my team?", "set up a meeting"), each person should act as themselves.
Each user signs in (new API Key credential; Teams so far had OAuth only)
GET /teams/callback) receives the browser's return and only stores the one-time code under its state; it never sees the client secret or the PKCE verifier.client_id | Dify user IDand Fernet-encrypted with a key derived (HKDF) from the client secret. Tokens never appear in tool output or logs; the user ID comes from Dify's runtime, never from the LLM.teams_sign_out: the new Agent exposes tools by their bare name and rejects duplicates, so it cannot share a name with Outlook'soutlook_sign_out.localhostcallback URL (what Dify shows whileENDPOINT_URL_TEMPLATEhas its default) and a path not ending in/teams/callback, and for a specific tenant proves the client ID and secret with a client-credentials token that is then discarded.TeamsProvider._SCOPE); a test keeps the two equal.There is no app-only mode: Microsoft Graph does not let app-only tokens post messages or read chats. All 21 tools are unchanged except that they pass themselves to
resolve_graph_context, which now returns the per-user token in this mode.The sign-in code (
tools/user_auth.py,endpoints/signin_callback.py) is the same as Outlook's apart from the scopes, the endpoint path and the key-derivation label, so that the two plugins' stored tokens can never be read by each other.Docs
Existing OAuth authorizations keep working unchanged; the version goes to 1.0.0 for the new mode and endpoint, matching Outlook.
Release Notes
Change Type
Screenshots / Videos
Agent on a self-hosted Dify with Outlook and Teams, both using Each user signs in:
Testing
pytest): full sign-in, cached and refreshed tokens, per-user isolation and encryption at rest, secret rotation, revoked vs. temporarily failing refresh, the callback rejecting unknown/expired/forged states and the cancel link, per-user validation (secret check, localhost, wrong path), the scopes matching OAuth's, and every tool's output variables.Checklist
manifest.yaml(0.2.1 → 1.0.0)