Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spring security reactive - how to debug "invalid credentials" error?

I want to authenticate users with an external OAuth provider in my reactive spring boot application.

Following the official tutorial, I successfully implemented the flow with the pre-configured providers (Google, Github, etc.). Changing the configuration to not-pre-configured providers can be done using these properties, e.g.:

spring.security.oauth2.client.registration.<providerName>.client-id=<clientId>
spring.security.oauth2.client.registration.<providerName>.client-secret=<clientSecret>
spring.security.oauth2.client.registration.<providerName>.redirect-uri={baseUrl}/login/oauth2/code/<providerName>
spring.security.oauth2.client.registration.<providerName>.provider=<providerName>
spring.security.oauth2.client.registration.<providerName>.client-authentication-method=basic
spring.security.oauth2.client.registration.<providerName>.authorization-grant-type=authorization_code

spring.security.oauth2.client.provider.<providerName>.authorization-uri=https://api.<providerName>.com/authorize
spring.security.oauth2.client.provider.<providerName>.token-uri=https://api.<providerName>.com/token

With this setup, the login page is prompted to the user, and the specified redirect url is called with the authCode:

redirect url called

However, this error page is returned, with no log entry or exception in the console (even if I set the logging.level.org.springframework.security=DEBUG property).

invalid credentials error

What could be the issue? Where can I even start debugging this?

like image 362
nagy.zsolt.hun Avatar asked Oct 28 '25 05:10

nagy.zsolt.hun


1 Answers

AuthenticationWebFilter.authenticate is the place to debug this. In my case user-info-uri attribute was missing

like image 60
nagy.zsolt.hun Avatar answered Oct 31 '25 01:10

nagy.zsolt.hun