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 / Copilot Studio Kit — "...
Copilot Studio
Suggested Answer

Copilot Studio Kit — "Failed to obtain authorization code or code verifier" during Test Run

(1) ShareShare
ReportReport
Posted on by 5
Hi Community,

I am running into an authentication error in the Power CAT Copilot Studio Kit when trying to execute a Test Run and would appreciate any guidance. I am trying to run test against agent with authentication method Entra ID v2 with client secrets
  
  Environment
  - Developer Environment (Power Platform)
  - Power CAT Copilot Studio Kit installed
  - Security roles assigned to my user: Kit Administrator + Kit Maker

  The Error
  When I save a Test Run record, a Microsoft login popup appears asking for authentication. After interacting with it, I get:
 "An error occurred while running the test. Please check the Agent Configuration. Failed to obtain authorization code or code verifier"
  The agent itself works fine — the Copilot Studio test pane works correctly.



Followed the official github page for enabling authentication: Power-CAT-Copilot-Studio-Kit/ENABLE-AUTHENTICATION.md at main · microsoft/Power-CAT-Copilot-Studio-Kit

Key Observation:
The error occurs during the OAuth popup interaction — a Microsoft login popup appears when the Test Run is saved, and the error(as can be seen in the above screen shot) is thrown during that popup. This suggests the authorization code redirect is failing somewhere.

What I Have Already Tried
 
  1. Disabled authentication on the agent → Test ran successfully in the Kit ✅ (confirms basic connectivity is fine, issue is auth-specific)
  2. Re-enabled auth and filled all Kit agent config fields per documentation
  3. Verified redirect URI is present in KitAuthApp — it is present
  4. Tried Edge browser — same error persists
  5. Checked third-party cookies — allowed in browser settings

Has anyone encountered this before? Any suggestions on what might be causing the code verifier failure specifically?

Thanks in advance!
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Valantis Profile Picture
    6,290 on at
     
    The "Failed to obtain authorization code or code verifier" error during the MSAL popup interaction points to a redirect URI or app registration configuration issue on KitAuthApp.
     
    Microsoft docs checklist for this exact scenario:
     
    1. In KitAuthApp (Azure Portal > App registrations):
       - Supported account types must be: Accounts in any organizational directory (Multitenant) AND personal Microsoft accounts
       - Redirect URI must be present and correct. The Kit uses PKCE flow (code verifier) so the redirect URI must be a Single-page application (SPA) type, not Web. This is the most common cause of the code verifier failure
     
    2. In CopilotStudioAuthApp:
       - Verify openid, profile, and User.Read permissions are added as Delegated and admin consent is granted
       - The custom scope must be Enabled and both admins and users can consent
       - KitAuthApp client ID must be in the Authorized client applications list
     
    3. In Copilot Studio Kit Agent Configuration:
       - Client ID = KitAuthApp client ID
       - Scope = the custom scope from CopilotStudioAuthApp (api://xxx/copilot.studio.scope)
       - Client Secret = the secret from KitAuthApp
       - Channel Security must be enabled in Direct Line settings
     
    The code verifier error specifically happens when the redirect URI type is set to Web instead of SPA. The PKCE flow requires the SPA redirect type in Azure.
     
     

     

    Best regards,

    Valantis

     

    ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/

    💼 LinkedIn

    ▶️ YouTube

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Valantis Profile Picture

Valantis 249

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 180 Super User 2026 Season 1

#3
Vish WR Profile Picture

Vish WR 153

Last 30 days Overall leaderboard