Hello all,
I am trying to implement the client_credentials grant to get a token in my spring boot resource server. I have tried to do the request through postman and it works. The problem I am facing is that i have no way to add the missing audience parameter to the token request.
I have the client filter configured like this.
@Bean
WebClient webClient(ReactiveClientRegistrationRepository clientRegistrations,
ServerOAuth2AuthorizedClientRepository authorizedClients) {
ServerOAuth2AuthorizedClientExchangeFilterFunction oauth2 = new ServerOAuth2AuthorizedClientExchangeFilterFunction(
clientRegistrations, authorizedClients);
oauth2.setDefaultClientRegistrationId("auth0");
return WebClient.builder()
.filter(oauth2)
.build();
}
I am injecting the instance and trying to do a request to get the user by email
return this.webClient.get()
.uri(this.usersUrl + "/api/v2/users-by-email?email={email}", email)
.attributes(auth0ClientCredentials())
.retrieve()
.bodyToMono(User.class);
Is there a way to skip the need to add the audience parameter or a way to add it to the webclient request in the filter function?