如何添加查询参数到一个node.js / express.js res.redirect函数?

我正尝试在我的应用中使用redirect用户到Google授权页面。 对于我的情况,我不能使用任何Google API模块。

我知道我可以格式化我的res.redirect()函数,如: res.redirect('https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar.readonly&response_type=code&redirect_uri=https%3A%2F%2Flocalhost%3A3000%2Fauth&client_id=690512789525-g8dbv0s1jo80u5hvevptqapeqokq7ees.apps.googleusercontent.com&hl=en&from_login=1&as=-6cc9a02870d13e22&authuser=0')

但我宁愿更清洁,我可以保留我的查询参数在一个对象。 就像是:

res.redirect({uri: 'https://accounts.google.com/o/oauth2/auth, scope: 'https://............etc', response_type: 'code', etc })用我的每个查询参数作为属性值对在我的对象。

任何想法如何做到这一点?

认为你需要像这样的url.format(urlObj) : https : url.format(urlObj)