我在一个OAuth2应用程序中成功地使用了FeathersJS来验证Facebook、Github等.现在,我尝试使用WordPress OAuth服务器对Wordpress服务器进行身份验证。我已经配置了它,并将所有配置参数设置为我认为正确的值:
...
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=“*”之后,我得到的唯一信息是:
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身份验证失败的信息,以便我可以检查哪种配置是错误的?
谢谢!
发布于 2019-07-16 07:03:01
我终于知道是什么失败了.我试着将DEBUG设置为“DEBUG=”(“护照”),然后我在控制台上获得了很多信息。我检查了这些信息,发现我的问题是我签发了一个自我签名的证书,以便在本地Wordpress服务器上进行测试。
对于任何需要它的人,为了避免使用Passport (或其他什么)抱怨使用自签名证书,我添加了以下几行:
if ('development' == app.get('env')) {
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
}在我的初始.js文件中(在我的例子中是index.js)。这避免了由于自签名证书而导致的任何SSL调用失败,而不是这样,而只是一个警告。
https://stackoverflow.com/questions/57042254
复制相似问题