Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return async (): Promise => {
if (client) {
return client;
}
const issuer = await Issuer.discover(`https://${settings.domain}/`);
client = new issuer.Client({
client_id: settings.clientId,
client_secret: settings.clientSecret,
redirect_uris: [settings.redirectUri],
response_types: ['code']
});
if (clientSettings.httpTimeout) {
const timeout = clientSettings.httpTimeout;
client[custom.http_options] = function setHttpOptions(options: ClientSettings): ClientSettings {
return {
...options,
timeout
};
};
}
if (clientSettings.clockTolerance) {
client[custom.clock_tolerance] = clientSettings.clockTolerance / 1000;
}
return client;
};
}
function overrideHttpOptions () {
this[custom.http_options] = options => Object.assign({}, options, httpOptions)
}
overrideHttpOptions.call(Issuer)