Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Strategy.prototype.authenticate = function(req, options) {
// When a user denies authorization on Twitter, they are presented with a link
// to return to the application in the following format (where xxx is the
// value of the request token):
//
// http://www.example.com/auth/twitter/callback?denied=xxx
//
// Following the link back to the application is interpreted as an
// authentication failure.
if (req.query && req.query.denied) {
return this.fail();
}
// Call the base class for standard OAuth authentication.
OAuthStrategy.prototype.authenticate.call(this, req, options);
};
Strategy.prototype.authenticate = function(req, options) {
// When a user denies authorization on Twitter, they are presented with a link
// to return to the application in the following format (where xxx is the
// value of the request token):
//
// http://www.example.com/auth/twitter/callback?denied=xxx
//
// Following the link back to the application is interpreted as an
// authentication failure.
if (req.query && req.query.denied) {
return this.fail();
}
// Call the base class for standard OAuth authentication.
OAuthStrategy.prototype.authenticate.call(this, req, options);
};
return done(error);
}
var profile = JSON.parse(body);
var namePieces = profile.fullName.split(' ');
verify(req, accessToken, refreshToken, {
id: profile.id,
firstName: namePieces.shift(),
lastName: namePieces.join(' '),
email: null
}, done);
}
);
});
this.name = 'trello';
};
TrelloStrategy.prototype = OAuth1Strategy.prototype;
module.exports = {
translateProfile: (token, tokenSecret, profile, cb) => { cb(null, profile); },
strategy: TrelloStrategy
};
request(`https://api.trello.com/1/members/me?key=${options.clientID}&token=${accessToken}`,
(err, response, body) => {
if (err) return done(err);
const profile = JSON.parse(body);
const namePieces = profile.fullName.split(' ');
const result = { id: profile.id };
result[config.auth.columns.user.firstName] = namePieces.shift();
result[config.auth.columns.user.lastName] = namePieces.join(' ');
result[config.auth.columns.user.email] = null;
verify(req, accessToken, refreshToken, result, done);
}
);
});
this.name = 'trello';
};
TrelloStrategy.prototype = Object.create(OAuth1Strategy.prototype);
module.exports = {
translateProfile: (token, tokenSecret, profile, cb) => { cb(null, profile); },
strategy: TrelloStrategy,
packageName: 'passport-oauth1'
};