I am developing a new app in Vue 3 and I am getting a 401 error when trying to post to my backendless app (trying to login a user). It also results in an error regarding the user’s email/password. I didnt have any issues with Vue 2.x however.
import Backendless from "@/plugins/backendless.js";
import { ref } from "vue";
export default {
setup() {
const email = ref(" ");
const password = ref("");
const Login = () => {
const stayLoggedIn = true;
console.log(email);
Backendless.UserService.login(
email.value,
password.value,
stayLoggedIn
).then(
// eslint-disable-next-line no-unused-vars
(user) => {
localStorage.setItem("LoggedUser", true);
Backendless.UserService.getCurrentUser()
.then((user) => {
if (user["role"] === "test") {
this.$router.push({ path: "/test" });
} else if (user["role"] === "two") {
this.$router.push({ path: "/two" });
} else if (user["role"] === "three") {
this.$router.push({ path: "/four" });
}
})
.catch((error) => {
console.log(error);
});
}
);
};
return {
email,
password,
Login,
};
},```
I set up a plugin to be included in my Vue instance:
import Backendless from “backendless”;
const APP_ID = “27C8E9A7-EEAF-31D3-FFD0-B8C10AD39300”;
const API_KEY = “xxxxx-xxxxx-xxxxxxx-xxxxx”;
Backendless.initApp(APP_ID, API_KEY);
export default Backendless;
Have I missed something particular to create this issue?