---
title: "Workday A2A & Copilot Studio OAuth invalid_request Fix"
description: "Why Microsoft Copilot Studio fails with OAuth2LoginStrategyCore and invalid_request when connecting to a Workday Agent2Agent (A2A) endpoint, and how to fix it."
url: https://kiweely.com/guides/workday-a2a-copilot-studio-oauth-invalid-request
---

# Fixing invalid\_request OAuth Token Exchange Errors When Connecting Microsoft Copilot Studio to Workday A2A

Connecting Microsoft Copilot Studio to a Workday Agent over the Agent2Agent (A2A) protocol fails with 400 BadRequest and invalid\_request when the token exchange omits Proof Key for Code Exchange (PKCE) or uses mismatched OAuth endpoints. Align PKCE and your ASOR Delegate skill settings to fix it.

-   **Checked** against Workday on November 6
-   Applies to **Workday Extend**
-   4 min read
-   Published November 6
-   By Kiweely

## Why the A2A OAuth token exchange returns `invalid_request`

When connecting Microsoft Copilot Studio to a Workday Agent (such as the Workday Self-Service Agent or a wrapped Custom Agent) over the **Agent2Agent (A2A)** protocol, the interactive browser login and consent prompt succeed, but the subsequent authorization-code exchange fails in Copilot Studio with:

text

```
OAuth2 authorization flow failed for service 'Generic Oauth 2'.
OAuth 2 sign in 'OAuth2LoginStrategyCore' failed to exchange code for access token.
Client ID and secret sent in form body.
Response status code=BadRequest.
Response body: {"error":"invalid_request"}
```

This `400 BadRequest` (`{"error":"invalid_request"}`) happens at the Workday Agent Gateway OAuth token endpoint (`https://<region>.agent.workday.com/auth/oauth2/<tenant-alias>/token`) for three specific reasons during Delegate-mode Agent System User (ASU) authentication:

1.  **Missing PKCE (`code_challenge` and `code_verifier`):** Workday’s A2A and Agent Gateway OAuth 2.1 implementation requires Proof Key for Code Exchange (PKCE) enabled on the external platform. When Copilot Studio’s `Generic Oauth 2` provider initiates the flow without PKCE, or when the authorization URL and token request do not pair a `code_challenge` with a `code_verifier`, the Agent Gateway rejects the code exchange with `invalid_request`.
2.  **Mixing the integration API client with the ASOR Delegate ASU client:** Creating an A2A connection requires two distinct OAuth clients in Workday. An Integration System User (ISU) client created via **Register API Client for Integrations** is used only once at setup time to download the `.well-known/agent-card.json` discovery file. The runtime Copilot Studio connection must use the **Agent System User (ASU)** OAuth Client ID and Client Secret generated by **Configure Agent** in **Agent Management Hub**.
3.  **Redirect URI or regional Agent Gateway URL mismatch:** The Redirect URL generated by Microsoft Copilot Studio must exactly match the Redirect URI saved under **OAuth Details for Delegate Skills** on the agent’s **Credentials** tab in Workday, and both the Authorize Endpoint and Token Endpoint must point to the regional Agent Gateway host (`https://us.agent.workday.com`), not the standard tenant `/ccx/oauth2/` REST endpoint.

## Separating the setup ISU client from the runtime ASU client

Before editing the Copilot Studio connection, verify that you are passing the right credentials into each step of the A2A handshake:

| Credential Set | Where It Is Created in Workday | Where It Is Used |
| --- | --- | --- |
|  **ISU Integration Client** (`client_id`, `client_secret`, `refresh_token`) |  **Register API Client for Integrations** with functional area *Agent System of Record* and **Include Workday Owned Scopes** checked | Used only in an API client (such as Bruno) to exchange the refresh string for a bearer credential and call `GET /v1/a2a/<tenant>/<agent-wid>/.well-known/agent-card.json` |
|  **Delegate ASU OAuth Client** (`client_id`, `client_secret`) | Generated automatically when you run **Configure Agent** on the external agent in **Agent Management Hub** (viewed or rotated on the **Credentials** tab) | Entered into Microsoft Copilot Studio’s A2A OAuth 2.0 connection settings for end-user Delegate sign-in |

If you paste the **Register API Client for Integrations** client ID into Copilot Studio’s interactive user login flow, the authorization code exchange against `/auth/oauth2/<tenant-alias>/token` will fail.

## Configuring the Workday A2A OAuth endpoints and PKCE

To complete the authorization code exchange cleanly between Microsoft Copilot Studio and the Workday Agent Gateway:

### 1\. Register the third-party agent definition with `Mode=Delegate`

When registering the external agent definition via `POST https://<region>.agent.workday.com/asor/v1/agentDefinition`, ensure the skill targeting the Self-Service Agent (`6bfadd7c014610000dffae8d77c00000`) or your Custom Agent WID uses `Mode=Delegate`:

json

```
{
  "workdayConfig": [
    {
      "skillId": "ssa-agent-as-a-tool",
      "executionMode": {
        "id": "Mode=Delegate"
      },
      "workdayResources": [
        {
          "tool_name": "Workday Self-Service Agent",
          "description": "Delegates employee self-service requests to Workday SSA",
          "agent_resource": {
            "id": "6bfadd7c014610000dffae8d77c00000"
          }
        }
      ]
    }
  ]
}
```

### 2\. Bind the Copilot Studio Redirect URI in Agent Management Hub

1.  In Microsoft Copilot Studio, add the A2A agent or custom OAuth 2.0 connector and copy the generated **Redirect URL** (for example, the Power Platform regional redirect callback URL).
2.  In Workday, open **Agent Management Hub** > **Agent Registry**, select your registered external agent, and click **Configure Agent** (or open the **Credentials** tab and click **Edit** under **OAuth Details for Delegate Skills**).
3.  Enable the skill’s **Status** toggle, assign the user security groups in **Available To**, and paste the exact Copilot Studio Redirect URL into the **Redirect URI** field.
4.  If you no longer have the original ASU Client Secret from initial setup, click **Generate a New Client Secret** on the **Credentials** tab and copy the new value immediately.
5.  Click **Activate Agent** on the agent profile if the agent is not yet active.

### 3\. Configure PKCE and the Agent Gateway URLs in Copilot Studio

In your external assistant or custom connector OAuth 2.0 settings, configure an OAuth 2.0 Authorization Code provider with **PKCE enabled** rather than a plain `Generic Oauth 2` profile that omits `code_verifier`:

-   **Client ID** — The ASU OAuth Client ID from **Agent Management Hub**
-   **Client Secret** — The ASU OAuth Client Secret from **Agent Management Hub**
-   **PKCE:** Enabled (sends `code_challenge` and `code_challenge_method=S256` on authorize, and `code_verifier` on token exchange)
-   **Authorization Endpoint:**
    
    text
    
    ```
    https://us.agent.workday.com/auth/authorize/acme_dpt1?response_type=code
    ```
    
-   **Token Endpoint:**
    
    text
    
    ```
    https://us.agent.workday.com/auth/oauth2/acme_dpt1/token
    ```
    
-   **Refresh Endpoint:**
    
    text
    
    ```
    https://us.agent.workday.com/auth/oauth2/acme_dpt1/token
    ```
    

Note that Workday’s token endpoint returns `expires_in` (`14400` seconds for a 4-hour access lifetime, with a 24-hour refresh lifetime), and across different test environments `expires_in` may serialize as either a JSON string or an integer.

## Isolating and verifying the token exchange in your tenant

Before testing inside Copilot Studio’s connection wizard, isolate the ASU OAuth flow in an HTTP client such as Bruno to verify your Client ID, Client Secret, and Redirect URI:

1.  Temporarily set the **Redirect URI** on the agent’s **Credentials** tab in **Agent Management Hub** to a localhost or test callback URL and open:
    
    text
    
    ```
    https://us.agent.workday.com/auth/authorize/acme_dpt1?response_type=code&client_id=YOUR_ASU_CLIENT_ID&state=equipmentAgentTest&redirect_uri=YOUR_REDIRECT_URI
    ```
    
2.  Sign in as a test worker belonging to a security group listed in **Available To** and click **Allow**.
3.  Exchange the returned `code` parameter via `POST https://us.agent.workday.com/auth/oauth2/acme_dpt1/token` with `Content-Type: application/x-www-form-urlencoded` and form fields `grant_type=authorization_code`, `code`, `redirect_uri`, `client_id`, `client_secret`, and `code_verifier` (when PKCE was used on the authorize request).
4.  Once the `POST` returns HTTP `200 OK` with an `access_token` and `refresh_token`, restore the Copilot Studio Redirect URI on the **Credentials** tab, re-test the connection in the Copilot Studio agent playground, and verify the session in Workday using the **View AI Agent User Audit Trail** report.

## Sources checked

-   [Connect External Agents to Workday Using A2A](https://developer.workday.com/documentation/GUID-f07913bb-126c-4284-aad8-753d94802615-enHYPHENus)
-   [Connect Custom Agents to External Agents Using A2A](https://developer.workday.com/documentation/GUID-59871309-bbc4-4f06-9a68-80c331c7ed7b-enHYPHENus)
-   [Concept: External Agent ASU Considerations](https://developer.workday.com/documentation/GUID-b3446bcf-9ed7-47b2-85f1-7449e0f68e54)
-   [Configure Microsoft Agent Sync](https://developer.workday.com/documentation/GUID-182d1b21-4f8f-4051-a8fd-def17c051e22-enHYPHENus)
-   [View External Agent Credentials](https://developer.workday.com/documentation/GUID-06065736-7eb0-4ea6-afbb-5000f458eb89-enHYPHENus)

## Related guides

[All guides](https://kiweely.com/guides)

-   [### Calling External Glean and Sana Agents From Workday Extend Without Hitting 408 Request Timeouts Direct outbound HTTP calls from a Workday Extend PMD page time out with Status Code 408 when an external Glean agent (/rest/api/v1/agents/runs/wait) or Sana webhook exceeds the presentation timeout. Route external agent runs through Workday Orchestrate and External Client CredStore.](https://kiweely.com/guides/workday-extend-external-agents-glean-sana-408-timeout)
-   [### Why a Workday Custom Agent Has No Credentials Tab in Agent Management Hub, and How to Expose It Through A2A Workday displays the Credentials tab in Agent Management Hub only for registered External Agents. To expose a Custom Agent built on Workday’s AI platform to an external assistant, register a third-party Agent Definition in the Agent System of Record that wraps the Custom Agent WID as an A2A tool.](https://kiweely.com/guides/workday-custom-agent-missing-credentials-tab-a2a)
-   [### Why Custom Agent Actions Fail With S22 Permission Denied or Task Not Authorized in Agent Chat Orchestration Builder runs Custom Agent Actions directly as your user, whereas Agent Chat enforces dual ASOR authorization and restricts the Agent System User token to the resources listed in your .agentskill file. Register every REST, SOAP, and WQL resource WID via the Finder API to fix it.](https://kiweely.com/guides/workday-custom-agent-actions-permission-denied-tool-wids)
-   [### Why Custom Agent Skills Deployed From the Developer Site Don’t Appear in Agent Management Hub, and ASOR Tenant Prerequisites When you deploy a Custom Agent with multiple .agentskill files from App Builder, Workday’s Agent System of Record packages all of their tools into a single combined skill registration that starts disabled. Learn how to enable and sync skills in Agent Management Hub and verify ASOR prerequisites.](https://kiweely.com/guides/workday-agent-management-hub-skills-not-showing)

### More guides on Custom agents and Workday AI

[All 91 guides](https://kiweely.com/guides#custom-agents)

-   [Fixing Workday Developer Agent VS Code Sign-In With a Personal Developer Account and Subagent Interrupt Errors](https://kiweely.com/guides/workday-developer-agent-vscode-personal-account-login)
-   [Finding Workday tool IDs with the Agent Resource Search (finder) API](https://kiweely.com/guides/workday-finder-api-tool-discovery)
-   [Connecting an Extend app to the Workday Self-Service Agent and Microsoft Teams](https://kiweely.com/guides/workday-extend-self-service-agent-teams)
-   [How to build a chatbot in Workday Extend](https://kiweely.com/guides/workday-extend-chatbot)
-   [How to call AI Gateway Document Intelligence from a Workday Extend app](https://kiweely.com/guides/workday-extend-ai-gateway-document-intelligence)
-   [Who gets Workday Developer Agent, and what it uses in Flex Credits](https://kiweely.com/guides/workday-developer-agent-access-flex-credits)
-   [Connecting a Workday custom agent to an outside agent platform with A2A](https://kiweely.com/guides/workday-custom-agents-a2a-external-agents)
-   [Why Workday custom agents use up Flex Credits so quickly](https://kiweely.com/guides/workday-custom-agent-usage-limits)

### From the blog on Custom agents and Workday AI

[All posts](https://kiweely.com/blog)

-   [ServiceNow AI agents vs Workday AI agents: operations vs HCM/finance build](https://kiweely.com/blog/servicenow-ai-agents-vs-workday-ai-agents)
-   [How Workday prospects should run an AI-agent-driven implementation methodology](https://kiweely.com/blog/workday-prospect-ai-agent-implementation-methodology)
-   [Salesforce Agentforce vs Workday AI agents: what each is actually for](https://kiweely.com/blog/salesforce-agentforce-vs-workday-ai-agents)

## Let Workday check the work.

Kiweely writes WQL and builds orchestrations in your own tenant, and Workday, not Kiweely, says whether they passed.

[Start for free](https://kiweely.com/download) [See how it works](https://kiweely.com/vine/how-it-works)

## Get the next guide in your inbox.

One email a month with new guides and one Extend tip. Nothing else.
