Skip to content

Auto Sign-In Requires Multiple User Messages to Succeed with Authorization Agent Token Exchange on Teams Channel #216

@Santhosh0505

Description

@Santhosh0505

Hi Team,

We’ve set up the Authorization Agent to handle token exchange without using a SignIn card, by configuring the Token Exchange URL within the OAuthSettings.

However, we’re encountering an issue where the auto sign-in process doesn’t consistently succeed on the user's first message. In most cases, the auto sign-in only completes successfully after the user sends 3 or more random messages. Once it succeeds, the request reaches the OnMessageAsync method as expected.

App Registration Configuration
Below are the configuration steps we followed for the Azure App Registration:

  1. Authentication
  1. API Permissions
  • Added permissions for Microsoft Graph (Delegated):

    • User.Read
    • openid
    • profile
    • offline_access
  • Added permissions for Power Platform API (Delegated):

    • CopilotStudio.Copilots.Invoke
  • Granted admin consent for the tenant.

  1. Certificates & Secrets

    Created a new client secret and securely stored the secret value.

  2. Expose an API

  • Set Application ID URI to api://botid-

    • Added a scope:
    • Scope name: access_as_user
    • Who can consent: Admins
    • Admin consent display name: Access Copilot Agents as user
    • Admin consent description: Allow the app to access Copilot Agents as you
    • State: Enabled

OAuthSettings Configuration

  • Name: MyTestApp
  • Service Provider: Azure Active Directory v2
  • Client Id: {Azure Bot Client Id}
  • Client Secret: {Azure Bot Client Secret}
  • Token Exchange URL: api://botid-{Azure Bot Client Id}
  • Tenant Id: {Tenant Id}
  • Scopes: profile openid

Issue
We need the auto sign-in to reliably succeed when the user sends their first message, without requiring multiple retries. Could you please help us identify what might be causing this behavior or suggest configuration adjustments to ensure a seamless auto sign-in experience on the first attempt?

Thanks in advance for your help!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions