web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / How do I get User.Acce...
Copilot Studio
Suggested Answer

How do I get User.AccessToken for Teams Bot using 'Authenticate with Microsoft'?

(0) ShareShare
ReportReport
Posted on by
My copilot teams agent communicates with my backend API by calling an http flow within a Topic. All messages are funneled through this flow. I want to pass the user token into my backend but I am unable to access the User.AccessToken variable as it's not available when the agent authentication is set as 'Authenticate with Microsoft' (set by admin) [Add user authentication to topics]. For some more context, I've added the AAD application's client ID and resource URI to the agent's teams channel details already.

So my question is, how do I access the user token so that it can be passed onto my backend? 
I have the same question (0)
  • Suggested answer
    lukoplt Profile Picture
    18 on at

    You cannot access the user’s token when the agent uses Authenticate with Microsoft. In this mode, Copilot Studio intentionally doesn’t expose User.AccessToken; configuring the AAD client ID and Resource URI on the Teams channel enables Teams SSO, but it doesn’t make the Teams token available to topics or flows.

    To pass a token explicitly to your HTTP flow, you must change the authentication. Steps:

    1. Change the agent authentication to Authenticate manually.
    2. Configure Microsoft Entra ID V2 (preferably with federated credentials).
    3. Configure the exposed API scope and Teams SSO/token-exchange settings.
    4. Republish the agent.
    5. Add a string input to the flow and pass User.AccessToken—shown as System.User.AccessToken in Power Fx contexts.
    6. Send it to your API as "Authorization: Bearer <Token>".

    Your backend must validate the token’s signature, issuer, audience and delegated scope.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
11manish Profile Picture

11manish 130

#2
Valantis Profile Picture

Valantis 119

#3
Haque Profile Picture

Haque 107

Last 30 days Overall leaderboard