Skip to content

Instantly share code, notes, and snippets.

@walidum
Created July 29, 2021 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walidum/7163f8a232513a432af5e7ccb865b173 to your computer and use it in GitHub Desktop.
Save walidum/7163f8a232513a432af5e7ccb865b173 to your computer and use it in GitHub Desktop.
login.js
exports.login = (req, res) => {
const registrationdata = {
userName: req.body.UserName,
password: req.body.Password
};
if (req.body.UserName && req.body.Password) {
const config = {
headers: {Authorization: `DirectLogin username="${req.body.UserName}", password="${req.body.Password}", consumer_key="b2yn2ma5fqegtlgghvdpq0unlj5xdrja5wwoecon"`}
};
axios.post('https://ifcsandbox.openbankproject.com/my/logins/direct',
{},
config
).then(data => {
if (!data) {
res.status(404).send({message: "Not found user with email " + registrationdata})
} else {
// res.send(data)
logindetails.username = req.body.UserName;
res.redirect('/add-activity');
}
})
.catch(err => {
res.status(500).send({message: "Erro retrieving user with email " + registrationdata})
})
} else {
res.status(500).send({message: "Erro retrieving user with email " + registrationdata})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment