'Custom redirectUri with Spring Security with OAuth2

I am using OAuth2 with Spring Security. The redirectUri in Okta should be mentioned as http://localhost:port/login/oauth2/code/okta. Can I configure a custom Redirect URI and in that case, what other changes I need to do for it to work?

Note: I added the below configuration for redirectURI which is mentioned in the Registration static class and had configured the same redirection uri on the Okta side. The application is not able to get the token as it is getting into a recursion. When I changed the call-back to http://localhost:8080/login/oauth2/code/okta in the Okta client configuration, it started working?

What is the significance of redirectURI parameter in the application.yml file.

spring:
  security:
    oauth2:
      client:
        registration:
          okta:
            client-id: 0oa47p3n9dwLxBkRi5d7
            client-secret: <confidential>
            redirectUri: http://localhost:8080/authorization-code/callback
            scope: openid
            clientName: okta
        provider:
          okta:
            authorizationUri: https://dev-7858070.okta.com/oauth2/default/v1/authorize
            tokenUri: https://dev-7858070.okta.com/oauth2/default/v1/token
            userInfoUri: https://dev-7858070.okta.com/oauth2/default/v1/userinfo
            jwkSetUri: https://dev-7858070.okta.com/oauth2/default/v1/keys
            issuerUri: https://dev-7858070.okta.com/oauth2/default


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source