Integrating Azure B2C with ChatGPT plugin for authentication

We are in the process of creating a plugin that requires authentication via an existing Azure B2C tenant. We are encountering an issue AADB2C99059, which states that the provided request must include a code_challenge. How should I modify the ChatGPT plugin to incorporate the code_challenge and code_challenge_method?

Below is the current authorization configuration:

"auth": {
    "type": "oauth",
    "client_url": "https://[ExampleTenant].b2clogin.com/[ExampleTenant].onmicrosoft.com/B2C_1_SignUpSignIn/oauth2/v2.0/authorize",
    "scope": "https://[ExampleTenant].onmicrosoft.com/b7f380c7-abc2-4b7c-91b7-10c91b451aef/read",
    "authorization_url": "https://[ExampleTenant].b2clogin.com/[ExampleTenant].onmicrosoft.com/B2C_1_SignUpSignIn/oauth2/v2.0/token",
    "authorization_content_type": "application/x-www-form-urlencoded",
    "verification_tokens": {
      "openai": "efa132d5bb66819b50aeb4cc70e12bd7"
    }
  }

The related documentation at this URL: Authorization code flow - Azure Active Directory B2C | Microsoft Learn

Hey,

At PluginLab.ai we have configured this sign-in method so our user can integrate it in no time, and we didn’t get this error.

The code challenge is only mandatory if you used a PKCE flow for SPA, I guess.

So, did you choose an OAuth App for an SPA or for a WebApp?

Could you show a screenshot of your app config (hiding the secret values)?

Thank you for the response. The issue is resolved after I changed the Platform configurations from SPA to Web. Now I can see that the authorization code is sent back but fails when it tries to get the token. The callback is failing with response : “detail”:“Error forwarding auth: {"message":"Missing access_token"}”}

When I check the log in B2C, I see the below log
|B2C|Authentication | Exchange token|ClientError | The request is missing required parameter: grant_type.|
|B2C|Authentication | Issue an authorization code to the application|| Success |