Is there a way to set client id + secret for OAuth2 at runtime for WebClient?
hooliooo
02/27/2020, 1:24 PM
is there a way to configure this at runtime?
c
Czar
02/27/2020, 8:13 PM
WebClient is just a reactive HTTP client, it has no idea about OAuth.
You can set OAuth filters for it yourself by either implement them or using something like Spring Security oauth support (which has some ready-to-use stuff for WebClient).
h
hooliooo
02/27/2020, 8:32 PM
The solution was to create a ClientRegistrationRepository and call
ClientRegistration.withRegistrationId
then configure it in code
👍 1
hooliooo
02/27/2020, 8:33 PM
I had to do it this way because the OAuth2 setup needs to be dynamic instead of the usual configuration in application.properties