简体   繁体   中英

Error: Can't set headers after they are sent NodeJS LinkedIn

Node.JS API

router.get('/signInLinkedIn', function(req, res, next) {
    Linkedin.setCallback('http://localhost:5000')
    var results = Linkedin.auth.authorize(res);
    res.write({response:results});
});

I would like to send the results back to the frontend but I got the following error:

Error: Can't set headers after they are sent

How can I fix it OR is there any workaround so that it send the response back to the frontend ?

So the workaround for this is var results = Linkedin.auth.authorize(); . Remove res

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