diff --git a/src/controllers/index.js b/src/controllers/index.js index 2d834c248f..d6d9d74c55 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -118,9 +118,13 @@ Controllers.login = function(req, res, next) { data.title = '[[pages:login]]'; if (!data.allowLocalLogin && !data.allowRegistration && data.alternate_logins && data.authentication.length === 1) { - return helpers.redirect(res, { - external: data.authentication[0].url - }); + if (res.locals.isAPI) { + return helpers.redirect(res, { + external: data.authentication[0].url + }); + } else { + return res.redirect(data.authentication[0].url); + } } if (req.uid) { user.getUserFields(req.uid, ['username', 'email'], function(err, user) {