简体   繁体   English

Passport-azure-ad Nodejs 访问令牌验证错误

[英]Passport-azure-ad Nodejs access token validation error

I am using passport-azure-ad on my nodejs api project to authorize requests that are coming in with an access token, I keep getting this error during the authorization process:我在我的 nodejs api 项目上使用 Passport-azure-ad 来授权使用访问令牌传入的请求,在授权过程中我不断收到此错误:

AzureAD: Bearer Strategy","hostname":"","pid":20016,"level":30,"msg":"authentication failed due to: Error: unable to get local issuer certificate","time. AzureAD: Bearer Strategy","hostname":"","pid":20016,"level":30,"msg":"身份验证失败,原因是:错误:无法获得本地颁发者证书","时间。

I dont know what could be causing this我不知道是什么原因造成的

Here is the quick solution but it is not secure.这是快速解决方案,但它并不安全。

npm config set strict-ssl false

It is not secure because this above command fetchs the modules from the server even if the server is not have valid identity or not have valid certificate.这是不安全的,因为即使服务器没有有效身份或没有有效证书,上述命令也会从服务器获取模块。

Here is the secure way .这是安全的方式 You can add any number of CA certificate that you required to identify servers.您可以添加识别服务器所需的任意数量的 CA 证书。 The certificate should be in “Base-64 encoded X.509 (.CER)(PEM)” format.证书应采用“Base-64 encoded X.509 (.CER)(PEM)”格式。

Read more here . 在这里阅读更多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM