# MS Agent Framework and Python: Use the Auth0 Token Vault to Call Third-Party APIs

**URL:** <https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959>\
**Category:** Blog Discussions\
**Tags:** python, fastapi, agent-framework, ai-agent, token-vault, api, ai\
**Created:** [October 31, 2025, 11:24am UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959 "2025-10-31T11:24:40Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrea.chiarelli](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andrea.chiarelli/32/16034_2.png) [@andrea.chiarelli](https://community.auth0.com/u/andrea.chiarelli)\
**Post date:** [October 31, 2025, 11:24am UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/1 "2025-10-31T11:24:40Z")

</div>

Learn how to build a secure Python AI Agent with Microsoft Agent Framework and FastAPI and use Auth0 Token Vault to securely connect to the Gmail API.

Read on [here](https://auth0.com/blog/microsoft-agent-framework-python-auth0-token-vault/)!

 ![image](https://global.discourse-cdn.com/auth0/original/3X/2/e/2e9095d9bcda450bc277c3c5907287361b0b5d67.jpeg)

---

<div class="post-metadata">

**Author:** ![andrea.chiarelli](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andrea.chiarelli/32/16034_2.png) [@andrea.chiarelli](https://community.auth0.com/u/andrea.chiarelli)\
**Post date:** [October 31, 2025, 11:26am UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/3 "2025-10-31T11:26:24Z")

</div>

Any questions? Any feedback? Drop your message here!

---

<div class="post-metadata">

**Author:** ![tinuvi.solutions](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tinuvi.solutions/32/61126_2.png) [@tinuvi.solutions](https://community.auth0.com/u/tinuvi.solutions)\
**Post date:** [November 23, 2025, 12:45pm UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/4 "2025-11-23T12:45:41Z")

</div>

My Account API seems to be required. Could you update the blog post with this new requirements?

---

<div class="post-metadata">

**Author:** ![andrea.chiarelli](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andrea.chiarelli/32/16034_2.png) [@andrea.chiarelli](https://community.auth0.com/u/andrea.chiarelli)\
**Post date:** [November 27, 2025, 2:56pm UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/5 "2025-11-27T14:56:36Z")

</div>

Hi @tinuvi.solutions,

Thank you for highlighting this. Actually, the blog post was published when Auth0 for AI Agents was in Early Access, and some things changed when it became Generally Available.

I fixed the missing part about the My Account API. Thanks! 🙏

---

<div class="post-metadata">

**Author:** ![joao.d.oliveira](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/joao.d.oliveira/32/77874_2.png) [@joao.d.oliveira](https://community.auth0.com/u/joao.d.oliveira)\
**Post date:** [December 22, 2025, 9:24am UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/6 "2025-12-22T09:24:07Z")

</div>

Great tutorial! However, I’m stuck on this error:

`AccessTokenForConnectionError: Federated connection Refresh Token not found.`

**My setup:**

- Auth0 app has Token Exchange grant enabled, Refresh Token Rotation OFF

- Google connection: Token Vault enabled, Offline Access checked, Gmail scopes added

- Code uses connection\_scope, prompt=consent, access\_type=offline

Auth0 logs show successful Google login (type: s) immediately followed by feta error “Federated connection Refresh Token not found.”

Is there something specific that makes Auth0 capture Google’s refresh token into Token Vault? Feels like Google is authenticating but the refresh token isn’t being stored.

---

<div class="post-metadata">

**Author:** ![andrea.chiarelli](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andrea.chiarelli/32/16034_2.png) [@andrea.chiarelli](https://community.auth0.com/u/andrea.chiarelli)\
**Post date:** [December 22, 2025, 4:17pm UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/7 "2025-12-22T16:17:33Z")

</div>

Hi @joao.d.oliveira,

Thank you for reading the article and trying the sample project.

Actually, the Offline Access on the Google connection should grant a refresh token from Google 🤔

I assume you have already checked everything on the Google side following [this document](https://auth0.com/ai/docs/integrations/google).

Also, you didn’t explicitly mention it, but I assume you have enabled and configured the [My Account API](https://auth0.com/docs/manage-users/my-account-api) as described [here](https://auth0.com/blog/microsoft-agent-framework-python-auth0-token-vault/#Call-the-Third-Party-API-Using-the-Token-Vault).

Please, double check and let me know if you have additional info.

---

<div class="post-metadata">

**Author:** ![joao.d.oliveira](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/joao.d.oliveira/32/77874_2.png) [@joao.d.oliveira](https://community.auth0.com/u/joao.d.oliveira)\
**Post date:** [December 22, 2025, 10:18pm UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/8 "2025-12-22T22:18:39Z")

</div>

Hi @andrea.chiarelli

Thanks for the swift answer!

I might be missing something, but I do believe I went diligently through the setup. I’m attaching screenshots of what I think are the most relevant configurations.

I’m wondering if there could be issues in the tenant account setup or the Auth0 ↔ GCP API linkage.

**To help pinpoint the issue, I see Token Vault as a 4-step process:**

1. **Registration** (user consent flow) — ✅ Works. I see my app’s permission request and the user approves it.

2. **User creation in Auth0** — ✅ Works. User is created in Auth0, I can re-login successfully.

3. **Credential storage** — ✅ Seems fine. Auth0 shows the user was created.

4. **Token retrieval from Token Vault** — ❌ Broken. This is where I get the Federated connection Refresh Token not found error.

I’d love guidance on how to debug step 4 specifically.

**Additional observations:**

- Auth0 dashboard shows successful login, authentication, and user creation

- Google Cloud Console shows **no API Requests** in my project’s metrics, however I **do see OAuth token grant rate** activity (grants occurring at the time of my login attempts). This suggests the OAuth flow itself is working, but something isn’t capturing/storing the refresh token.

- When I start a fresh registration, I do see my Google project being used for the OAuth consent screen

This makes me think the issue is in how Auth0 handles/stores the refresh token from Google, rather than the OAuth flow itself.

Is there a way to verify that the refresh token is actually being captured and stored by Auth0 during the initial authentication?

Thanks!

---

<div class="post-metadata">

**Author:** ![andrea.chiarelli](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andrea.chiarelli/32/16034_2.png) [@andrea.chiarelli](https://community.auth0.com/u/andrea.chiarelli)\
**Post date:** [January 9, 2026, 3:31pm UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/9 "2026-01-09T15:31:42Z")

</div>

Hi @joao.d.oliveira,

Thanks for the additional details and for your patience.

I see you also opened an [issue](https://github.com/auth0-samples/auth0-ai-samples/issues/66) on the sample project and the [explanation](https://github.com/auth0-samples/auth0-ai-samples/issues/66#issuecomment-3720502037) given by my colleague. Unfortunately, this blog post was written when Auth0 for AI Agent was in beta, and a few things have changed since then. While AI apps using the [AI SDKs](https://auth0.com/ai/docs/sdks/python-sdk#auth0-ai-sdks) for LangGraph and LlamaIndex work seamlessly, for the MS Agent Framework (which doesn’t have a dedicated Auth0 AI SDK currently), I need to adapt the code. Just to let you know that I’m working on it.

Thanks again for your patience.

---

<div class="post-metadata">

**Author:** ![andrea.chiarelli](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andrea.chiarelli/32/16034_2.png) [@andrea.chiarelli](https://community.auth0.com/u/andrea.chiarelli)\
**Post date:** [January 21, 2026, 8:36am UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/10 "2026-01-21T08:36:06Z")

</div>

The blog post has been updated!

It uses the new settings for connected accounts and handles the `AccessTokenForConnectionError`error.

Thank you for raising this issue and for your patience 🙏

---

<div class="post-metadata">

**Author:** ![joao.d.oliveira](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/joao.d.oliveira/32/77874_2.png) [@joao.d.oliveira](https://community.auth0.com/u/joao.d.oliveira)\
**Post date:** [January 23, 2026, 10:31pm UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/11 "2026-01-23T22:31:59Z")

</div>

Thanks Andrea — and apologies for the silence, I was on holidays.

Also, thanks again for the great article and for updating the post to use the new connected accounts settings and handle the AccessTokenForConnectionError.

Quick update: I got my setup working and Token Vault is now behaving as expected — I’ve been using it successfully.

Best of luck!  
Joao

---

<div class="post-metadata">

**Author:** ![tinuvi.solutions](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tinuvi.solutions/32/61126_2.png) [@tinuvi.solutions](https://community.auth0.com/u/tinuvi.solutions)\
**Post date:** [February 5, 2026, 11:22pm UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/12 "2026-02-05T23:22:10Z")

</div>

Hi Andrea! Is there an updated library to handle connected accounts flow for Django? I’m analyzing **auth0-fastapi** library. [Look at this](https://github.com/auth0/auth0-fastapi/blob/e7310baf30a8b5f62dad69619bb458222af69014/src/auth0_fastapi/server/routes.py#L76-L77). This is not supported by `authlib` which is recommended by the [current Django documentation](https://auth0.com/docs/quickstart/webapp/django). Is that true?

---

<div class="post-metadata">

**Author:** ![tinuvi.solutions](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tinuvi.solutions/32/61126_2.png) [@tinuvi.solutions](https://community.auth0.com/u/tinuvi.solutions)\
**Post date:** [February 7, 2026, 9:47pm UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/13 "2026-02-07T21:47:33Z")

</div>

I have another question. We can’t initiate the **connected account flow** right away because we need a user access token with the proper scope, right?

That means we always have to start the **authorization code flow** without the connected account first. Then, once that step is finished, we can trigger the connected account flow. Does that sound right? Only when this last step is concluded I’m able to get the access token from the connected account (i.e. Google).

I’m asking because it seems like the user has to **grant permissions twice** : once when they first log in, and again for the connected account flow. This gets even more complicated when you introduce **account linking** into the mix.

---

<div class="post-metadata">

**Author:** ![andrea.chiarelli](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andrea.chiarelli/32/16034_2.png) [@andrea.chiarelli](https://community.auth0.com/u/andrea.chiarelli)\
**Post date:** [February 10, 2026, 1:52pm UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/14 "2026-02-10T13:52:13Z")

</div>

Hi @tinuvi.solutions, I’m not aware of a specific library for managing connected accounts in Django. Probably @jesstemporal knows more

---

<div class="post-metadata">

**Author:** ![andrea.chiarelli](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andrea.chiarelli/32/16034_2.png) [@andrea.chiarelli](https://community.auth0.com/u/andrea.chiarelli)\
**Post date:** [February 10, 2026, 2:19pm UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/15 "2026-02-10T14:19:23Z")

</div>

You are right. The general flow is to authenticate first and then trigger the connected account flow.

Unfortunately, when using the same IdP to authenticate and get the connected account (as in the sample code in this blog post), you will be requested to grant permissions twice.

The authentication and connected account flows are separated because you can use different accounts. For example, you can authenticate with Auth0 and then connect your Auth0 account to your Google account.

> This gets even more complicated when you introduce **account linking** into the mix.

The connected account flow replaces the account linking behavior for Token Vault from the Developer Preview.

---

<div class="post-metadata">

**Author:** ![tinuvi.solutions](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tinuvi.solutions/32/61126_2.png) [@tinuvi.solutions](https://community.auth0.com/u/tinuvi.solutions)\
**Post date:** [February 11, 2026, 12:48pm UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/16 "2026-02-11T12:48:29Z")

</div>

> [@andrea.chiarelli](#):
>
> The connected account flow replaces the account linking behavior for Token Vault from the Developer Preview.

Does it replace? 🤔 Look at this scenario:

- You log in as email + password (`auth0` provider)
- Execute connected account flow with your Google account
- Log out
- Log in using the same Google account
- You end up with two users on Auth0 Dashboard (just check it at `https://manage.auth0.com/dashboard/us/YOUR_TENANT/users`)

This means account linking is more vital than never. It avoids you paying two seats (MAU). Beyond that, you have to create very complicated infrastructure code to deal with this limitation.

---

<div class="post-metadata">

**Author:** ![jesstemporal](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jesstemporal/32/66824_2.png) [@jesstemporal](https://community.auth0.com/u/jesstemporal)\
**Post date:** [February 11, 2026, 2:52pm UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/17 "2026-02-11T14:52:50Z")

</div>

> [@tinuvi.solutions](#):
>
> Is there an updated library to handle connected accounts flow for Django? I’m analyzing **auth0-fastapi** library. [Look at this](https://github.com/auth0/auth0-fastapi/blob/e7310baf30a8b5f62dad69619bb458222af69014/src/auth0_fastapi/server/routes.py#L76-L77)

Hi @tinuvi.solutions for the Django app you’ll have to use the [auth0-server-python](https://github.com/auth0/auth0-server-python) package since this is the base SDK for all the Auth0 Python SDKs like the FastAPI one. I haven’t used Django in a while but expect you can use the [MyAccountClient](https://github.com/auth0/auth0-server-python/blob/main/src/auth0_server_python/auth_server/my_account_client.py#L22) to reproduce the same behavior you saw in the FastAPI example you shared.

> [@tinuvi.solutions](#):
>
> This is not supported by `authlib`

You are right `authlib` has all the OAuth support but the “My Account” API is not standard OAuth, its Auth0’s technology. 🙂

Also thanks @Andrea.chiarelli for tagging me in.

---

<div class="post-metadata">

**Author:** ![tinuvi.solutions](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tinuvi.solutions/32/61126_2.png) [@tinuvi.solutions](https://community.auth0.com/u/tinuvi.solutions)\
**Post date:** [February 11, 2026, 10:45pm UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/18 "2026-02-11T22:45:39Z")

</div>

Thank you for helping me out! I’d actually already seen that library, but sadly, it doesn’t work for our setup. We use `Django` with `Gevent` ([you can see why here](https://charlesleifer.com/blog/asyncio/)), and that library requires `asyncio`. ☹

We ended up building our own library from scratch. Basically, we translated the `auth0-fastapi` and `auth0-server-python` libraries to create an opinionated way of handling account linking, connected account flows, and so on. My big concern is that the `My Account API` is not GA. 🤯 I used to use Token Vault, but it changed so drastically that I had to focus on account linking instead—at least until I found a serious bug in it. Well, [there is a specific topic for that](https://community.auth0.com/t/auth0-fails-to-store-refresh-tokens-for-linked-accounts/196953).

---

<div class="post-metadata">

**Author:** ![andrea.chiarelli](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andrea.chiarelli/32/16034_2.png) [@andrea.chiarelli](https://community.auth0.com/u/andrea.chiarelli)\
**Post date:** [February 13, 2026, 3:46pm UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/19 "2026-02-13T15:46:30Z")

</div>

Hi @tinuvi.solutions,

You are right on this scenario. I shared your feedback internally.

My reference was to the Token Vault account linking action used in the Developer Preview, which is no longer a functional way to obtain tokens for another account now.

---

<div class="post-metadata">

**Author:** ![tinuvi.solutions](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tinuvi.solutions/32/61126_2.png) [@tinuvi.solutions](https://community.auth0.com/u/tinuvi.solutions)\
**Post date:** [February 15, 2026, 11:49am UTC](https://community.auth0.com/t/ms-agent-framework-and-python-use-the-auth0-token-vault-to-call-third-party-apis/193959/20 "2026-02-15T11:49:50Z")

</div>

We just open-sourced our library. Check it out here:

> **[GitHub - tinuvi/auth0-oauth-client: Tired of fighting Auth0’s quirks? Stop the...](https://github.com/tinuvi/auth0-oauth-client)**
>
> Tired of fighting Auth0’s quirks? Stop the struggle 👋! Check out this small but honest helper lib 🤏
