Issue
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
:
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).
What could be the issue? Where can I even start debugging this?
Solution
AuthenticationWebFilter.authenticate
is the place to debug this. In my case user-info-uri
attribute was missing
Answered By - nagy.zsolt.hun
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)