I am trying to configure an application M2M accessing a Resource Server configuring Spring 3.4.4 with Java 21.
I am trying to implement oAuth2Client lib (spring-security-oauth2-client) of Spring, but there is no documentation of how to set audience parameter to FeignClient can manage tokens automatically.
I am not a Spring expert, however, if you are unable to customize the client by overriding the defaults as mentioned in this documentation, you can attempt to initialize the FeignClient and pass in request headers and parameters in which you can inclue the necessary information to handle the M2M communication:
@FeignClient(name="myClient", url = "{{application_url}}", configuration = {{confguration_file}}.class)
public interface MyClient {
@RequestMapping(method = RequestMethod.GET, value = "{{auth0_endpoint}}")
@Headers("Accept", "Content-Type: application/json")
public String audience(@Param("{{your_audience}}") String audience;