Hello,
I have a project on Node JS. In this project I'm using express js. Let's clearify...
This is my express backend-ed project..
const request = require('request-promise');
const options = {
method: 'POST',
uri: 'http://localhost/forum/api/token',
json: true,
agentOptions: {
rejectUnauthorized: false
},
headers: {
"identification": "Chenzy",
"password": "pass",
"lifetime": 3600000
}
}
request(options).then(function (response){
res.status(200).json(response);
})
.catch(function (err) {
console.log(err);
})
I just want to make a system that provides when a user Login from my site, s/he will also login in flarum too. I really don't know how to do that and when I try to run it gives me an error
statusCode: 400,
statusMessage: 'Bad Request',
body: '<!doctype html>\n' +
'<html>\n' +
' <head>\n' +
' <meta charset="utf-8">\n' +
' \n' +
' <title>Project X</title>\n' +
' <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">\n' +
'\n' +
' <style>\n' +
' * {\n' +
' box-sizing: border-box;\n' +
' }\n' +
' body {\n' +
' font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";\n' +
' font-size: 18px;\n' +
' text-align: center;\n' +
' line-height: 1.5;\n' +
' color: #333;\n' +
' }\n' +
' input,\n' +
' button,\n' +
' select,\n' +
' textarea {\n' +
' font-family: inherit;\n' +
' font-size: inherit;\n' +
' line-height: inherit;\n' +
' }\n' +
' a {\n' +
' cursor: pointer;\n' +
' color: #4D698E;\n' +
' text-decoration: none;\n' +
' font-weight: bold;\n' +
' }\n' +
' a:hover {\n' +
' text-decoration: underline;\n' +
' }\n' +
' .container {\n' +
' margin: 100px auto;\n' +
' max-width: 450px;\n' +
' padding: 0 15px;\n' +
' }\n' +
' .button {\n' +
' display: inline-block;\n' +
' padding: 15px 25px;\n' +
' background: #4D698E;\n' +
' color: #fff;\n' +
' text-decoration: none;\n' +
' text-align: center;\n' +
' vertical-align: middle;\n' +
' border-radius: 4px;\n' +
' cursor: pointer;\n' +
' white-space: nowrap;\n' +
' font-weight: bold;\n' +
' border: 0;\n' +
' }\n' +
' .button:hover {\n' +
' text-decoration: none;\n' +
' }\n' +
' .button:active,\n' +
' .button.active {\n' +
' box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);\n' +
' }\n' +
' .form {\n' +
' max-width: 300px;\n' +
' margin: 0 auto;\n' +
' }\n' +
' .form .button {\n' +
' display: block;\n' +
' width: 100%;\n' +
' }\n' +
' .form-control {\n' +
' display: block;\n' +
' width: 100%;\n' +
' text-align: center;\n' +
' padding: 15px 20px;\n' +
' background-color: #fff;\n' +
' border: 2px solid #eee;\n' +
' border-radius: 4px;\n' +
' transition: border-color .15s;\n' +
' }\n' +
' .form-control:focus,\n' +
' .form-control.focus {\n' +
' border-color: #4D698E;\n' +
' outline: none;\n' +
' }\n' +
' .errors {\n' +
' color: #d83e3e;\n' +
' }\n' +
' .errors ul {\n' +
' list-style-type: none;\n' +
' margin: 0;\n' +
' padding: 0;\n' +
' }\n' +
' </style>\n' +
' </head>\n' +
'\n' +
' <body>\n' +
' <div class="container">\n' +
' <p>\n' +
' You have been inactive for too long.\n' +
' </p>\n' +
' <p>\n' +
' <a href="javascript:history.back()">\n' +
' Go back, to try again\n' +
' </a>\n' +
' </p>\n' +
' </div>\n' +
' </body>\n' +
'</html>\n'
}
Sorry for bad English.
Thanks for helping 🙂