Login with JavaScript
Options
Andre Brossi
Member ✭
I'm trying to login to xano from a web application with javascript.
Code:
function login(){
event.preventDefault()
var url = 'xxxxxxxxxxxxxxxxxxxxxx/login'
email = document.getElementById("email").value;
password = document.getElementById("password").value;
obejct = {
"email": email,
"password": password
}
makePost(url,object);
}
function makePost(url, object){
let request = new XMLHttpRequest();
request.open ("POST", url, true);
request.setRequestHeader("Content-Type","applictaion/json");
request.send(object);
request.onload = function(){
console.log(this.responseText);
}
return request.responseText
}
But I'm getting the following responseBut I'm getting the following response::But I'm getting the following response:{"code":"ERROR_CODE_INPUT_ERROR","message":"Missing param: field_value","payload":{"param":"field_value"}}
What is wrong?
Comments
-
I've seen this before. In that case, in the Xano function stack the client had a query for managing authentication. And in that query it is asking for a "field_value" that was supposed to be a variable, but instead is probably now a string. Fixing the reference in the stack cleaned up the problem. I did this online with the client as part of a mentoring session, which you can sign up for on my site. The form emails you a scheduling link that can get you sorted same day/next day.
But take a look for yourself first - sometimes a fresh pass reveals the problem without outside help! As one approach, find where you have the "field_value" reference, and make sure it points to a variable or an input, and not a fixed text value.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback