简体   繁体   中英

Reactive Spring Security Oauth2 : invalid redirect url

I have configured a redirect url in application.yml file. It is throwing 404 error

security:
    oauth2:
      client:
        registration:
          test:
            client-id: xxx
            client-secret: xxx
            scope: email
            authorization-grant-type: authorization_code            
            redirect-uri: http://localhost:8080/kp/oauth2/redirect

It is working fine when redirect url is

http://localhost:8080/login/oauth2/code/redirect

Is there any pattern in constructing redirect url?

Since you are using spring's oauth2 feature, and spring is the one completing OAuth2 complete flow for you, which includes redirection URI, you can't give your own URI http://localhost:8080/login/oauth2/code/redirect this is the default URI.

FYI you don't have to mention redirect-URI in the first place as it is the default.

On the other hand, if you want to manually complete the OAuth2 flow you have can give a custom redirect URI, you just have to make that redirect URI as your endpoint manually and code the flow yourself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM