Function oauthCallback
has 45 lines of code (exceeds 25 allowed). Consider refactoring.
const oauthCallback = async (req, res, next) => {
const strategy = req.params.strategy;
if (req.body.strategy === false && req.body.key) {
try {
Function checkOAuthUserProfile
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
const checkOAuthUserProfile = async (profil, key, provider, res) => {
try {
const query = {};
query[`providerData.${key}`] = profil.providerData[key];
TODO found
* TODO: escape deprecated
Similar blocks of code found in 3 locations. Consider refactoring.
return res
.status(200)
.cookie('TOKEN', token, { httpOnly: true })
.json({
user,
Similar blocks of code found in 3 locations. Consider refactoring.
return res
.status(200)
.cookie('TOKEN', token, { httpOnly: true })
.json({
user,
Similar blocks of code found in 3 locations. Consider refactoring.
return res
.status(200)
.cookie('TOKEN', token, { httpOnly: true })
.json({
user,
Similar blocks of code found in 2 locations. Consider refactoring.
} else if (!user) {
const _err = JSON.stringify(err);
const path = 'token?message=Could%20not%20define%20user%20in%20oAuth';
res.redirect(302, `${url}/${path}&error=${_err}`);
} else {
Similar blocks of code found in 2 locations. Consider refactoring.
if (err) {
const _err = JSON.stringify(err);
const path = 'token?message=Unprocessable%20Entity';
res.redirect(302, `${url}/${path}&error=${_err}`);
} else if (!user) {
Identical blocks of code found in 5 locations. Consider refactoring.
const token = jwt.sign({ userId: user.id }, config.jwt.secret, {
expiresIn: config.jwt.expiresIn,
});
Identical blocks of code found in 5 locations. Consider refactoring.
const token = jwt.sign({ userId: user.id }, config.jwt.secret, {
expiresIn: config.jwt.expiresIn,
});
Identical blocks of code found in 5 locations. Consider refactoring.
const token = jwt.sign({ userId: user.id }, config.jwt.secret, {
expiresIn: config.jwt.expiresIn,
});
Identical blocks of code found in 5 locations. Consider refactoring.
const token = jwt.sign({ userId: user.id }, config.jwt.secret, {
expiresIn: config.jwt.expiresIn,
});
Identical blocks of code found in 5 locations. Consider refactoring.
const token = jwt.sign({ userId: user.id }, config.jwt.secret, {
expiresIn: config.jwt.expiresIn,
});
There are no issues that match your filters.