0

I have a login screen that coded with js and runs on a node.js server. I have an apache lounge server that listens to node server and I have a grafana dashboard that show the data. I need to bypass the grafana authentication. To do that I am trying to send userdata from apache server to grafana with basic authentication. When I'm tring to send data only with apache server I can send data and baypass the grafana authentication. But when I'm trying to send data from node server to grafana with apache server I can't send data to grafana server. I'm new to node.js so can anyone help me?

Here is the sample of my code.

app.get('/dashboard',(req,res) => {
    if(session.userdata ='ok'){ 
       var options = {
          url:req.session.url,
          auth: {
              user : req.session.userName,
              password : req.session.password
          }
       }
      request(options,function(err,res,body)
      {
      console.log('headers',res.headers)
      }
   }
}

I already try to solve my problem with these questions. Here, Here and Here

Thank you for your helps.

Jiraiya
  • 101
  • 1
  • 9
  • Sounds like you make your node code pass the credentials to the apache server, which then fails to in turn pass those on to grafana? – CBroe Nov 13 '20 at 11:27
  • Yes but I think the problem is between the node and apache but I'm not sure btw. – Jiraiya Nov 13 '20 at 11:54
  • Guessing isn’t really helpful, you need to properly analyze the problem. If you are making a request _from_ node directly _to_ the apache server, and are passing credentials while doing that - then there is no obvious apparent reason, why those credentials should not arrive on the apache side. If you can not figure this out yourself, then you need to start by giving a _proper_ explanation of how your current setup works - _“I'm using apache server to listen node.js and pass it to grafana”_ is anything but precise. – CBroe Nov 13 '20 at 12:00
  • Okay then. Let me open up the problem a bit more. I'm using grafana to show IOT data. I need auth for people to login. I'm not using generic grafana login screen. I wrote login and menu page with js and host it with node.js. To the grafana side I use [link](https://grafana.com/docs/grafana/latest/auth/auth-proxy/) to connect with apache server.When I'm unplugging the node.js I can send auth to grafana from apache server but when I start my login page I can't pass the variables to the grafana side. – Jiraiya Nov 13 '20 at 12:11

0 Answers0