[英]How to integrate OIDC Provider in Node jS
I tried to Integrate OIDC Provider to Node JS and I have a Sample Code.我尝试将 OIDC 提供程序集成到节点 JS,并且我有一个示例代码。 So, I run this Sample code it's throwing an error(unrecognized route or not allowed method (GET on /api/v1/.well-known/openid-configuration)).The problem is Issuer(https://localhost:3000) this Issuer is working fine.
所以,我运行这个示例代码,它抛出了一个错误(无法识别的路由或不允许的方法(GET on /api/v1/.well-known/openid-configuration))。问题是 Issuer(https://localhost:3000)这个发行人工作正常。 but i will change this Issuer((https://localhost:3000/api/v1/)) it's not working How to fix this Issue and I facing another issue also when I implement oldc-provider in node js.
但我会更改这个 Issuer((https://localhost:3000/api/v1/)) 它不起作用如何解决这个问题,当我在节点 js 中实现 oldc-provider 时我也面临另一个问题。 They Routes are override how to fix this issue
他们的路线被覆盖如何解决这个问题
Sample.js示例.js
const { Provider } = require('oidc-provider');
const configuration = {
// ... see available options /docs
clients: [{
client_id: 'foo',
client_secret: 'bar',
redirect_uris: ['http://localhost:3000/api/v1/'],
true_provider: "pcc"
// + other client properties
}],
};
const oidc = new Provider('http://localhost:3000/api/v1/', configuration);
// express/nodejs style application callback (req, res, next) for use with express apps, see /examples/express.js
oidc.callback()
// or just expose a server standalone, see /examples/standalone.js
const server = oidc.listen(3000, () => {
console.log('oidc-provider listening on port 3000, check http://localhost:3000/api/v1/.well-known/openid-configuration');
});
Error错误
Defining Issuer Identifier with a path component does not affect anything route-wise.使用路径组件定义颁发者标识符不会影响任何路由。
You have two options, either mount the provider to a path (see docs ), or define the actual paths you want for each endpoint to be prefixed (see docs ).您有两个选择,将提供程序安装到路径(请参阅文档),或定义您希望为每个端点添加前缀的实际路径(请参阅文档)。
I think you're looking for a way to mount, so the first one.我认为您正在寻找一种安装方式,所以第一个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.