I'm just starting out with this project
Currently, I am developing a Vue application that connects to a WordPress backend and requires user login. To achieve this, I have implemented the Simple JWT-Login plugin. I've successfully managed to send the email and password to the backend and retrieve the JSON Web Token (JWT). However, when attempting to log in by sending the JWT back to the backend, I encounter an error message stating "Bad Request." Below is the function responsible for handling the login process:
async login(){
try{
const response = await axios.post('/?rest_route=/simple-jwt-login/v1/auth&email=email&password=password',
{
email: this.email,
password: this.password,
}
);
const token = response.data.data.jwt
localStorage.setItem('token', token)
console.log(token)
const login = await axios.get(`/?rest_route=/simple-jwt-login/v1/autologin&JWT=${token}`)
console.log(login)
// this.$router.push("/");
} catch(err){
console.log(err)
// if(err.response.status === 400){
// this.error = "Wrong credentials! Please make sure"
// }
} finally{
}
}