Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

225
Views
¿Cómo envío los datos al lado del cliente desde el nodo js?

Estoy tratando de enviar rdata en la solicitud, pero no puedo obtener rdata porque /callback de llamada ha cambiado, así que traté de hacerlo así:

cliente

 useEffect(() => { const apiCall = async () => { const response = await axios.get(`http://localhost:5000/callback:id`); console.log(response); }; apiCall(); }, []);

servidor

 app.get("/callback", cors(), (req, res) => { if (req.query.code !== null && req.query.code !== undefined) { var token_url = "https://www.ssoservice.kr/oauth2.0/token"; var options = { url: token_url, method: "POST", form: { grant_type: "authorization_code", client_id: client_id, client_secret: client_secret, redirect_uri: redirectURI, code: req.query.code, state: req.query.state, }, }; request(options, function (error1, response1, body1) { if (!error1 && response1.statusCode == 200) { var tdata = JSON.parse(body1); var options2 = { url: "https://www.ssoservice/oauth2.0/resource", headers: { "Content-Type": "application/json", Authorization: "Bearer " + tdata.access_token, }, }; request(options2, function (error2, response2, body2) { if (!error2 && response2.statusCode == 200) { var rdata = JSON.parse(body2); res.writeHead(200, { "Content-Type": "text/json;charset=utf-8" }); res.end(rdata); console.log(rdata); ////////////////this data//////////// } else { res.status(response2.statusCode).end(); console.log("error2 = " + response2.statusCode); } }); } else { res.status(response1.statusCode).end(); console.log("error1 = " + response1.statusCode); } }); } });
sin embargo, no puedo obtener los rdata

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!