Решение для справки других.Я должен был положить все в обещание.
Issuer.discover('https://accounts.google.com/.well-known/openid-configuration')
.then((googleIssuer: { issuer: any; metadata: any; Client: any; }) => {
// console.log('Discovered issuer %s %O', googleIssuer.issuer, googleIssuer.metadata);
const client = new googleIssuer.Client({
client_id: process.env.GOOGLE_ID,
client_secret: process.env.GOOGLE_SECRET,
redirect_uris: ['list of URIs here'],
response_types: ['code token id_token'],
});
const params = {
client_id: process.env.GOOGLE_ID,
response_type: 'code token id_token',
scope: 'openid profile email',
nonce: generators.nonce(),
redirect_uri: 'URI here',
state: generators.state(),
prompt: 'select_account',
display: 'popup',
login_hint: 'sub',
};
const verify = ( tokenSet: any, userInfo: any, done: (arg0: null, arg1: any) => void ) => {
console.log('USERINFO: ', userInfo);
console.log('TOKENSET: ', tokenSet);
return done(null, tokenSet);
};
const options = {
client,
params,
};
Passport.use('openid-client', new Strategy( options, verify ));
}).catch((err: any) => {
if (err) {
console.log(err);
}
});