I'm trying to create a new user on my forums from a external script using VueJS + Axios, but, I keep getting 405 error.
Log
/api/users 405 (Method Not Allowed)
#:1 Failed to load /api/users: Response for preflight has invalid HTTP status code 405.
Code I'm using
axios.post(forumAPI, {
data: {
attributes: {
username: this.data.attributes.username,
password: this.data.attributes.password,
email: this.data.attributes.email,
}
},
headers: {
'Authorization': 'Token XXXXX',
'Content-Type': 'application/vnd.api+json'
},
})
.then(function (response) {
store.dispatch('login', this.data.attributes).then(() => {
this.$router.push(this.$route.query.redirect || '/dev');
this.loading = false;
this.hideModal();
})
})
.catch(function (error) {
console.log(error);
_this.loading = false;
})
Searching around, looks that it's a error with CORS, but, can't figure out how fix it.
Can anybody help me?