【发布时间】:2019-05-24 04:07:48
【问题描述】:
我正在使用 typescript 构建一个 MERN 堆栈应用程序。我正在为用户身份验证使用带有 openid-client 策略 (https://github.com/panva/node-openid-client/blob/master/docs/README.md#strategy) 的护照。我收到以下类型错误:
TypeError: client must be an instance of openid-client Client
我尝试过使用 Issuer.discover 和 new Issuer(),并等待/异步,确保 node 和我所有的包都是最新的,但无济于事。
这是相关代码:
import { Issuer, Strategy, generators } from "openid-client";
const googleClient = Issuer.discover("https://accounts.google.com/.well-known/openid-configuration")
.then((googleIssuer: { Client: any; }) => {
return googleIssuer.Client;
});
它应该返回一个 openid-client 客户端实例,但它返回一个待处理的承诺。
【问题讨论】:
标签: reactjs typescript passport.js openid-connect