to make a website, you need to use single sign-on, the front end is built with vue-cli, and then use build to package the project and put it in express and forward it through express. But because single sign-on is successful, it will jump directly to my index.html, so I don"t know how to get the directory structure of token
express returned to me by the front-end page in the express route:
index.htmlvue
loginindex
vue-cliindex.html:
oidc-client.jsjs
login.jsjs
login.js:
sessionsession Storageexpress:
asked my colleagues at the lower back end. They said that webserver generally receives values by sending requests in the page. I wrote the following code
in the app.js of express.app.post("/user/login", function(req, res) {
res.status(200)
res.json({ message: "Token" })
console.log(req)
})
the code called in the login method in the project"s login.js is as follows:
function log() {
Array.prototype.forEach.call(arguments, function(msg) {
if (msg instanceof Error) {
msg = "Error: " + msg.message;
} else if (typeof msg !== "string") {
msg = JSON.stringify(msg, null, 2);
}
console.log(msg)
//sessionexpress
var ajax = new XMLHttpRequest();
ajax.setRequestHeader("Content-type", "application/json");
ajax.open("post", "...");
ajax.send(msg)
console.log(ajax.status);
});
}
but after running like this, single sign-on will not work, and the forwarding layer in the middle of express, has not been used for the first time. I would like to ask you to be familiar with the mistakes made by Daniel in express, or a better and more reasonable way to get the information in session Storage. Thank you
.