Home › Forums › Backend Issues (wp-admin) › create a registration form with Vue.js front end
Hey first of all sorry for my english i m a student.
SO i m trying create a projet using Vue for front and WP rest Api with CPTUI and ACF for back.
My problem is with authentification, because when i tried create a user account i have this
xhr.js?b50d:210 POST http://localhost/laetitia-mutti/wordpress/wp-json/wp/v2/utilisateurs 401 (Unauthorized)
my front code looking like this :
export default {
name: 'Create_user',
data() {
return {
utilisateurs: { // Structure d'un participant
acf: {
nom: null,
email: null,
mdp: null,
}
},
}
},
methods: {
creer: function () {
// Se signer par JWT API
// axios({
// method: 'post',
// url: param.auth,
// data: {
// 'username': param.user,
// 'password': param.psw
// }
// }).then(function (response) {
// console.log("Reponse token", response);
//
// let token = response.data.token;
// console.log("Token", token);
axios({
method: 'post',
data: {
title: this.utilisateurs.acf.nom,
status: "publish",
fields: {
nom: this.utilisateurs.acf.nom,
email: this.utilisateurs.acf.email,
mdp: this.utilisateurs.acf.mdp,
}
},
url: param.host + 'utilisateurs',
// headers: {'Authorization': 'Bearer ' + token}
}).then(function (response) {
console.log("Retour création utilisateurs", response);
}.bind(this))
.catch(error => {
console.log("ERREUR création utilisateurs");
console.log(error)
})
// }.bind(this))
// .catch(error => {
// console.log("ERREUR création média");
// console.log(error)
// })
// }.bind(this))
// .catch(error => {
// console.log("ERREUR Autorisation token");
// console.log(error)
// })
}
}
}
and by back with simple user CPTUI and acg group fiels asking name email and password.
Can somebody help me plz? My project is for next friday :///
By the way,
I tried unactive JWT and delete all from my code,
but still doesnt work
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.