Authentication help


I’m trying to get the authentication token and for some reason I’m getting an error when I send the rest call. Here is the code I’m using -

var token = {}; var msgdata = {}; namespace = $("#****").val(); msgdata['username'] = $("#****").val(); msgdata['email'] = $("#****").val(); msgdata['password'] = $("#********").val(); $.ajax({ type: "POST", contentType: "application/json", dataType: "json", data: JSON.stringify(msgdata), url: "https://******", success: function (data) { token = data.response.user.authentication_token; console.log("Login go"); }, error: function (data) { console.log("Login no-go"); }, });

Obviously the *'s are replaced with the correct information. Any idea why it’s getting an error response? Thanks for the help


Hi Kyle,

Thanks for reaching out.
We would get back to you shortly with an answer.


Hi Kyle,
The call works fine on my side (copy pasted the above code).

  • Make sure you use your username in both the username and email fields while making the calls.
  • If your ajax call goes into error then there is some network problem or url issue.(though url seems fine above).
  • Else you could do a console.log(data) in success part to see if there is an error response in login (invalid password/username, etc).


Thanks for the quick response!

When I run the code and watch the console, the console runs the error message from my login attempt. It unfortunately doesn’t run the success part, but the error part. The only data I get back from the error message is the HTML code from the Flytsim login page, which is weird.


Hi Kyle,
I dont see why there should be any issue, but anyway I am attaching a html file with the same code you sent which works for me. The console should show the proper messages .


Ok, it’s logging in now. I was trying to put my username and password directly into the JS, but for some reason it didn’t like that. Thanks for your help!!

EDIT: I found the real issue, I had incorrect formatting of my username and password in my JS. The username and password are now stored in my JS and login works fine.