首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >FeathersJS:如何调试OAuth2身份验证过程?

FeathersJS:如何调试OAuth2身份验证过程?
EN

Stack Overflow用户
提问于 2019-07-15 14:48:44
回答 1查看 265关注 0票数 0

我在一个OAuth2应用程序中成功地使用了FeathersJS来验证Facebook、Github等.现在,我尝试使用WordPress OAuth服务器对Wordpress服务器进行身份验证。我已经配置了它,并将所有配置参数设置为我认为正确的值:

代码语言:javascript
复制
...
const OAuth2Strategy = require('passport-oauth2').Strategy;

...
app.configure(oauth2({
    name: 'wordpress',
    Strategy: OAuth2Strategy,
    authorizationURL: 'https://192.168.1.86/wp-content/plugins/miniorange-oauth-20-server/web/index.php/moserver/authorize',
    tokenURL: 'https://192.168.1.86/wp-content/plugins/miniorange-oauth-20-server/web/index.php/moserver/token',
    successRedirect: '/',
    failureRedirect: '/',
    clientID: 'CLIENT_ID',
    clientSecret: 'CLIENT_SECRET'
  }));

但是FeathersJS服务器总是无法进行身份验证。问题是,我看不到任何关于它为什么失败的信息,在设置环境变量DEBUG=“*”之后,我得到的唯一信息是:

代码语言:javascript
复制
  feathers-authentication:express:expose-headers Exposing Express headers to hooks and services +36s
  feathers-authentication:express:expose-cookies Exposing Express cookies to hooks and services undefined +36s
  feathers-authentication:express:expose-headers Exposing Express headers to hooks and services +127ms
  feathers-authentication:express:expose-cookies Exposing Express cookies to hooks and services undefined +127ms
  feathers-authentication:middleware:failure-redirect Clearing old 'feathers-jwt' cookie +37s
  feathers-authentication:middleware:failure-redirect Redirecting to / after failed authentication. +0ms

有谁知道如何获得更多关于为什么OAuth2身份验证失败的信息,以便我可以检查哪种配置是错误的?

谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-07-16 07:03:01

我终于知道是什么失败了.我试着将DEBUG设置为“DEBUG=”(“护照”),然后我在控制台上获得了很多信息。我检查了这些信息,发现我的问题是我签发了一个自我签名的证书,以便在本地Wordpress服务器上进行测试。

对于任何需要它的人,为了避免使用Passport (或其他什么)抱怨使用自签名证书,我添加了以下几行:

代码语言:javascript
复制
if ('development' == app.get('env')) {
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
}

在我的初始.js文件中(在我的例子中是index.js)。这避免了由于自签名证书而导致的任何SSL调用失败,而不是这样,而只是一个警告。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57042254

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档