Does Azure Bot Service support PKCE for OAuth connections?

Kuldeep Ravaliya 0 Reputation points Microsoft Employee
2026-08-31T13:52:10.1033333+00:00

Does Bot Service support PKCE for OAuth connections? Both generic providers expose a PKCE Type field, but with it set to  S256  we see no challenge emitted: "Generic Oauth 2" produces an authorize URL with no  code_challenge  at all, and the templated "Oauth 2 Generic Provider" sends  code_challenge=%7BCodeChallenge%7D  — the  {CodeChallenge}  placeholder passed through literally, while  {ClientId} ,  {RedirectUrl}  and  {State}  all substitute correctly.

Thanks!

User's image

Azure AI Bot Service
Azure AI Bot Service

An Azure service that provides an integrated environment for bot development.


1 answer

Sort by: Newest
  1. Allan Solomon Mejia 8,000 Reputation points
    2026-08-31T15:41:33.4633333+00:00

    Hello @Kuldeep Ravaliya

    Based on the current Bot Service documentation and the behavior you reproduced, don't treat PKCE as supported by Azure Bot Service OAuth connections at this time.

    Microsoft documents the Generic OAuth providers and their supported templates. For the customizable OAuth 2 Generic Provider, documented placeholders include {ClientId}, {RedirectUrl}, {Scopes}, {State}, etc., but Microsoft does not document {CodeChallenge} / {CodeVerifier} as supported dynamic substitutions.

    That aligns with your results:

    • Generic OAuth 2 with PKCE S256 doesn't emit code_challenge.
    • OAuth 2 Generic Provider sends {CodeChallenge} literally rather than generating/substituting a challenge.

    The Bot Framework Token Service normally performs the OAuth authorization-code flow and manages the resulting tokens on behalf of the bot.

    Therefore, if your identity provider requires PKCE, I don't see a documented way to implement it using the built-in Bot Service OAuth connection alone. You would likely need to implement the PKCE authorization flow outside the Bot Service Token Service, where your application generates and retains the code_verifier and supplies the corresponding code_challenge.

    Given that the Azure portal exposes a PKCE Type field despite the documented/provider behavior, raise this with Microsoft Support. It could be an undocumented feature, a portal/backend mismatch, or a defect, and Microsoft would need to confirm which.

    Avoid relying on the PKCE field in production until Microsoft confirms the expected behavior.

    Help make this community better for everyone: if this answer resolved your issue, please accept it or upvote it. If not, share more details in a comment so we can continue the discussion and find the right solution.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.