I can get the function to work perfectly in preview mode, but when published, I'm getting a FORBIDDEN error.
"jsonPayload":{
"message":"["message: Permission Denied\ndetails:\n applicationError:\n description: Forbidden\n code: FORBIDDEN\n data: {}"]"
}
It's obviously some permission level issue. I'm just not sure where that might be. The code is pretty simple:
async function generateNewId(toReset) { //Delete old Member Id and Register a New One let id = members.deleteMember(toReset.memberId) .then(() => { console.log('deleted...', toReset.memberId) }) .then(() => { let options = { 'contactInfo': { firstName : toReset.firstName, lastName : toReset.lastName } } console.log('options are...', options) let memberId = authentication.register(toReset.email, toReset.password, options) .then((result) => {return result.member._id}) .catch((err) => console.log(err)) return memberId }) .catch((err) => console.log(err)) return id }
Hi @Brian Cairns ,
You miss the option: {suppressAuth:true} to override the permission.
On the frontend, if you are not signed in with admin account / role, you cannot do such operation on default.
Does it help?
Duh. Thank you. I'll give it a try. I knew it had to be something simple I was overlooking.