Ad
Google IAP Using Node Certificate Has Expired Error?
I have a node server which needs to connect to an IAP (Identity Aware Proxy) protected API endpoint. The below example from Google seems to be fine expect for the certificate has expired
error. I believe I simply need to send rejectUnauthorized: false
along with the request, but I am not sure how to implement it.
Update
I was able to force it to work with adding process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
but it is my understanding that this option is more insecure compared to rejectUnauthorized: false
. Any insight?
'use strict';
const {JWT} = require('google-auth-library');
const keys = require('./jwt.keys.json');
const oauth2Keys = require('./iap.keys.json');
async function main() {
const clientId = oauth2Keys.web.client_id;
const client = new JWT({
email: keys.client_email,
key: keys.private_key,
additionalClaims: {target_audience: clientId},
});
const url = `https://iap-demo-dot-el-gato.appspot.com`;
const res = await client.request({url});
console.log(res.data);
}
main().catch(console.error);
Link to the Google Example: https://github.com/googleapis/google-auth-library-nodejs/blob/502f43e651d7ccbd1cc19de513d5f5af5008ac03/samples/iap.js
Ad
Answer
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
disables the SSL certificate check.
Ad
source: stackoverflow.com
Related Questions
- → Maximum call stack exceeded when instantiating class inside of a module
- → Browserify api: how to pass advanced option to script
- → Node.js Passing object from server.js to external modules?
- → gulp-rename makes copies, but does not replace
- → requiring RX.js in node.js
- → Remove an ObjectId from an array of objectId
- → Can not connect to Redis
- → React: How to publish page on server using React-starter-kit
- → Express - better pattern for passing data between middleware functions
- → Can't get plotly + node.js to stream data coming through POST requests
- → IsGenerator implementation
- → Async/Await not waiting
- → (Socket.io on nodejs) Updating div with mysql data stops without showing error
Ad