0

I am working on o365 integration, i'm intercepting O365 redirect call in one backend service(A -> node app) and then sending it to other backend service(B -> spring app) where spring security handles all the token and redirect to URL using SavedRequestAwareAuthenticationSuccessHandler class and after sending redirect, I want to intercept that response in backend service(A) from where we called the backend service(B), so that i can use that response and modify. Right now i'm getting some default html(node default index html may be) in reposnse which is of no use. What should i do here to intercept the 307 reponse in node server?

I tried calling to Backend service(B) from backend service(A) using request-promise and then intercept back in resolver

var socialAuthIntercept = (req, res, next) => {
  return new Promise((resolve, reject) => {
    var url = loadBalancer('server-B');
    var options = {
      url: url + '/v3/login/' + req.params.authProvider,
      method: 'GET',
      headers: req.headers,
      qs: req.query
    };
    console.log("options => \n");
    console.log(options);
    request(options).then(response => {
      console.log("inside resolve");
      console.log("Response => \n\n\n");
      console.log(response);
      console.log("\n\n\n\n\n\nResponse End");
      res.send(response);

    }).catch(error => {
      
        console.log("inside error");
        reject(error);
      });
  });
}
dur
  • 15,689
  • 25
  • 79
  • 125

0 Answers0