我正在尝试使用PingFederate作为我的Auth服务器和passport-ping npm登录。
我做了所有常用的配置,即
app.get("/auth/ping", passport.authenticate("ping"));
app.get("/auth/ping/callback",
passport.authenticate("ping",{ failureRedirect: '/login'}),
function(req,res){
console.log(profile);
res.render("profile", {user : req.user});
}
);
和
// Ping Strategy
passport.use(new PingStrategy({
host: 'blahblah.com',
port: 9031,
clientID: config.ping.clientID,
clientSecret: config.facebook.clientSecret,
callbackURL: config.ping.callbackURL
},
function(accessToken, refreshToken, profile, done) {
User.findOrCreatePingUser(profile, done);
}));
我甚至可以从PingFederate获得许可,并且重定向正在从那里发生。但是,当Passport尝试解析此授权代码时,它会抛出以下错误:
Express
500 TokenError: Invalid client or client credentials
at Strategy.OAuth2Strategy.parseErrorResponse (c:\Sandbox\node_modules\passport-ping\node_modules\passport-oauth\node_modules\passport-oauth2\lib\strategy.js:298:12)
at Strategy.OAuth2Strategy._createOAuthError (c:\Sandbox\node_modules\passport-ping\node_modules\passport-oauth\node_modules\passport-oauth2\lib\strategy.js:345:16)
at c:\Sandbox\node_modules\passport-ping\node_modules\passport-oauth\node_modules\passport-oauth2\lib\strategy.js:171:43
at c:\Sandbox\node_modules\passport-ping\node_modules\passport-oauth\node_modules\passport-oauth2\node_modules\oauth\lib\oauth2.js:177:18
at passBackControl (c:\Sandbox\node_modules\passport-ping\node_modules\passport-oauth\node_modules\passport-oauth2\node_modules\oauth\lib\oauth2.js:124:9)
at IncomingMessage. (c:\Sandbox\node_modules\passport-ping\node_modules\passport-oauth\node_modules\passport-oauth2\node_modules\oauth\lib\oauth2.js:143:7)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:943:16
at process._tickCallback (node.js:419:13)
有人可以帮帮我吗?我错过了什么吗?
答案 0 :(得分:0)
不是Passport无法解析响应,而是PingFederate授权服务器返回错误响应;你应该检查你使用的client_id / client_secret与PingFederate中配置的内容; FWIW:clientSecret: config.facebook.clientSecret
对我来说似乎是一个可以用来反对PingFederate的秘密......