microsoft-foundry / microsoft-foundry/foundry-samples
How to access incoming OAuth Token?
@therealjohn is already working on this.
Since Jun 17, 2026.
- Dominant language
- Bicep
- Stars
- 445
- Forks
- 494
- Avg merge
- 11h 35m
- Merged PRs (30d)
- 38
Description
I have a API - lets say API A, which will call Agent (Foundry Hosted Agent).
The Agent code is the most basic written using python agent framework and uses Hosting Adapter, it has a chatClient as agent - and uses - from_agent_framework(agent).run()
This Agent must call another API, lets say API B which requires OAuth token as well, but this OAuth must be a OBO (on-behalf-of token) to preserve initial API A user identifier in original token.
To create a OBO token, Agent A will require to get access to token sent in Authorization Header otherwise how will it create OBO using original incoming token.
So, in Agent A, how do I access the original OAuth Token in agent_framework?
Thanks.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.