0

i have developed the micro service application, in that application there is a service call user service which is running on port 8281. This service handle the authentications. when i test the service in local environment this is worked fine. But if i call this service using zuul api gateway this is not working. following property in the application.yml file is use to get the redirect url in the local environment. This is worked fine.

  security:
    oauth2:
      client:
        registration:
          google:
            redirectUri: "http://localhost:8281/oauth2/callback/google"

But if i change this property as follow for connect with zuul api gateway.

  security:
    oauth2:
      client:
        registration:
          google:
            redirectUri: "http://localhost:8080/api/user/oauth2/callback/google"

This is not working and is throw this error message [authorization_request_not_found]. localhost:8080 is the zuul api gateway. zuul has configure to forward request to user service like this.

zuul:
  prefix: /api
  routes:
    auth-service:
      path: /user/**
      serviceId: USER-SERVICE
      stripPrefix: true
      sensitiveHeaders: Cookie,Set-Cookie

so why this error is thrown ?

  • Well, with this config the redirect path will be /user/bla, so it starts with /user. Is that correct? – Gimby Feb 17 '20 at 08:48
  • yes this is correct.` /user` for the user service. then call back endpoint is `oauth2/callback/google` – Harshana Samaranayake Feb 17 '20 at 09:03
  • So how does this end up on your user service running on port 8281? Do you have a zuul filter which changes the host? – Gimby Feb 17 '20 at 15:09
  • Does this answer your question? [Using Spring security oauth, using a custom OAuth provider, I get \[authorization\_request\_not\_found\], should I handle the callback method myself?](https://stackoverflow.com/questions/50908023/using-spring-security-oauth-using-a-custom-oauth-provider-i-get-authorization) – Eleftheria Stein-Kousathana Feb 19 '20 at 14:55

0 Answers0