I'm trying to login using PingFederate as my Auth Server and passport-ping npm.
I did all the usual configurations, i.e
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});
}
);
And
// 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);
}));
I'm even able to give permission from PingFederate and redirection is happening fine from there. However, when Passport tries to parse this authorization code, it's throwing the following error:
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)
Can somebody help me out please? Am I missing something?
it is not Passport fails to parse the response, it is the PingFederate authorization server that returns an error response; you should check the client_id/client_secret that you use against what is configured in PingFederate; FWIW: clientSecret: config.facebook.clientSecret seems suspicious to me as a secret to use against PingFederate...