microsoft-foundry / microsoft-foundry/foundry-samples

How to access incoming OAuth Token?

Open
#599 1 comment 1 reaction 1 assignee View on GitHub

@therealjohn is already working on this.

Since Jun 17, 2026.

question
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.