fix(teams): look up users in their own tenant in getUser() - #961
Open
Shubham-Padkonde wants to merge 1 commit into
Open
Shubham-Padkonde wants to merge 1 commit into
Shubham-Padkonde wants to merge 1 commit into
Conversation
getUser() called Graph through the app-level client, whose token is issued by the app's own tenant. Users of other tenants do not exist in that directory, so Graph returned 404 and getUser() returned null. Use the tenant cached for the user and request the Graph token from that tenant. Move @microsoft/teams.graph to dependencies, as its client is now constructed at runtime. Fixes vercel#953 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Shubham Padkonde <shubhampadkonde12@gmail.com>
Contributor
|
@Shubham-Padkonde is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been 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
Fixes #953.
getUser()looked users up throughapp.graph, whose token is issued by the app's own tenant (appTenantId). Users of other tenants do not exist in that directory, so Graph returned404 Request_ResourceNotFoundandgetUser()returnednull.TeamsApp.graphFor(tenantId)returns a Graph client whose token is requested from the given tenant (getAppGraphToken(tenantId), same base URL asapp.graph). Without a tenant, or for the app's own tenant, it returnsapp.graph.getUser()passes the tenant already cached for the user (teams:tenantId:<userId>), the same valueopenDM()uses.@microsoft/teams.graphmoves fromdevDependenciestodependencies, since itsClientis now constructed at runtime (it is already a dependency of@microsoft/teams.apps). The lockfile change is limited to that move.Test plan
graphFor()requests the token from the given tenant, andgetUser()uses the cached tenant's client; both fail before this change.vitest runinpackages/adapter-teams(390 tests),tsc --noEmit, andultracite checkon the changed files pass. I did not run the fullpnpm validate, and I could not test against a real second tenant.Checklist
git commit -s)pnpm validatepasses🤖 Generated with Claude Code