title: ClientCredentialsReactiveOAuth2AuthorizedClientProvider only support form data? Can it support JSON data as body?
body: <p>We have a SpringBoot (2.4.3) application which is a client to other 3rd party micro services
  Some of these 3rd party micro services are secured via OAuth2.
  Most of them accept client token request body as form data.
  However, some accept client token request body as JSON data.</p>
  <p>We are using SpringBoot WebClient for communication and have followed instructions to get it configured for OAuth2.
  It works fine for those clients that accept form data for the client token request.
  However, authentication requests are failing with a 400 for clients that only accept token request body as JSON data.</p>
  <p>I did some digging and found that in our code we use the ReactiveOAuth2AuthorizedClientProviderBuilder to build the ReactiveOAuth2AuthorizedClientProvider which is used by the AuthorizedClientManager.
  Because the grant type is client_credentials the implementation returned by the builder (ClientCredentialsReactiveOAuth2AuthorizedClientProvider) uses WebClientReactiveClientCredentialsTokenResponseClient
  which extends AbstractWebClientReactiveOAuth2AccessTokenResponseClient.
  This class uses BodyInserters.FormInserter to build the request body.</p>
  <pre><code>@Override
  public Mono&lt;OAuth2AccessTokenResponse&gt; getTokenResponse(T grantRequest) {
      Assert.notNull(grantRequest, &quot;grantRequest cannot be null&quot;);
      // @formatter:off
      return Mono.defer(() -&gt; this.webClient.post()
              .uri(clientRegistration(grantRequest).getProviderDetails().getTokenUri())
              .headers((headers) -&gt; populateTokenRequestHeaders(grantRequest, headers))
              .body(createTokenRequestBody(grantRequest))
              .exchange()
              .flatMap((response) -&gt; readTokenResponse(grantRequest, response))
      );
      // @formatter:on
  }
  
  I believe the problem is the user of FormInserters to build the body.
  private BodyInserters.FormInserter&lt;String&gt; createTokenRequestBody(T grantRequest) {
      BodyInserters.FormInserter&lt;String&gt; body = BodyInserters.fromFormData(OAuth2ParameterNames.GRANT_TYPE,
              grantRequest.getGrantType().getValue());
      return populateTokenRequestBody(grantRequest, body);
  }
  </code></pre>
  <p>I believe this is causing the token request body to be form data as opposed to JSON data.
  How can I configure the ReactiveOAuth2ClientProvider to build the client token body as JSON data?</p>