1000 Error

Right now, when I try to register a user or login a user, I am getting a Error 1000:
{“code”:1000,“message”:“Entity with ID login not found”,“errorData”:{}}

This is definetly an error on the backendless part, because it was working Yesterday.

Beyond that, I know the Rest Request is correct:

  1. data:
  2. login: “b@b.com
  3. password: “b”
  4. proto: Object
  5. headers:
  6. Content-Type: “application/json”
  7. proto: Object
  8. method: “POST”

Please advise, things like this will force me to go somewhere else.

Hello @Shaun_Regenbaum

Sorry for the inconvenience. Tell me please, is still happening with you?

If yes, provide your app id, and say how you send a request? SDK or Codeless?

Regards, Dima

Same issue with me as well, All the documentations have the login API as: https://api.backendless.com/APP_ID/REST_API_KEY/users/login, but it isn’t working now when I try use it appgyver. Can you please update on the issue or suggest an alternative.

Are you sending it as get, post, or put request?
Are you setting the Content-Type header?
What does request body look like?

Hello React project you not work login
“code”: 1000,
“message”: “Entity with ID login not found”,
“errorData”: {}

code
const baseUrl = ‘https://xxx.backendless.app/api’;

export const login = (email, password)=>{

return  fetch(`${baseUrl}/users/login`,{

    method:'POST',

    headers:{

        'content-type': 'application/json'

    },

    body:JSON.stringify({email, password})

}).then(res=> res.json())

Hello @Grozdan_Gospodinov

For login use signature with login and password
REST Backendless Login API
JS Backendless Login API

I’m have this form login
Ask name=“email” change login

                    <input id="first-name" className="input100" type="text" name="email" placeholder="User email"/>

                    <span className="focus-input100"></span>

                </div>

                <div className="wrap-input100 rs2-wrap-input100 validate-input m-b-20" data-validate="Type password">

                    <input className="input100" type="password" name="password" placeholder="Password"/>

                    <span className="focus-input100"></span>

                </div>

@Grozdan_Gospodinov , what do you want us to do with this?

authService.js my code is

const baseUrl = ‘https://stronglove.backendless.app/api’;

export const login = async(email, password)=>{
let res= await fetch(${baseUrl}/users/login,{
method:‘POST’,
headers:{
‘content-type’: ‘application/json’
},
body:JSON.stringify({email, password})
});

let jsonResult = await res.json();


if (res.ok) {
    return jsonResult;
} else {
    throw jsonResult.message;
}

}

export const register = (email, password) => {
return fetch(${baseUrl}/users/register, {
method: ‘POST’,
headers: {
‘content-type’: ‘application/json’
},
body: JSON.stringify({ email, password })
})
.then(res => res.json());
};

Login,js this my code is

import { Link } from “react-router-dom”
import { useHistory } from “react-router”;
import background from “./…/…/…/…/images/image1.jpg”
import * as authService from “…/…/…/…/services/authService”
import { useContext } from ‘react’;
import { AuthContext } from “…/…/…/…/contexts/AuthContext”

function Login(){
const { login } = useContext(AuthContext);
const historyLogin = useHistory()

const onLoginHandler = (e) => {
    e.preventDefault();

    let formData = new FormData(e.currentTarget);

    let email = formData.get('email');
    let password = formData.get('password');

	console.log(email);
	console.log(password)

     authService.login(email, password)
        .then((authData) => {
             login(authData);
		
			 historyLogin.push("/themes");
		
			})       
        .catch(err => {
             // TODO: show notification
             console.log(err);
        });
}

return(
<>

Account Login
				<div className="wrap-input100 rs1-wrap-input100 validate-input m-b-20" data-validate="Type user name">
					<input id="first-name" className="input100" type="text" name="email" placeholder="User email"/>
					<span className="focus-input100"></span>
				</div>
				<div className="wrap-input100 rs2-wrap-input100 validate-input m-b-20" data-validate="Type password">
					<input className="input100" type="password" name="password" placeholder="Password"/>
					<span className="focus-input100"></span>
				</div>
				
				<div className="container-login100-form-btn">
					<button className="login100-form-btn">
						Sign in
					</button>
				</div>

				<div className="w-full text-center">
					<Link to="/register" className="txt3">
						Sign Up
					</Link>
				</div>
			</form>

			<div className="login100-more" style={{backgroundImage: `url(${background})`}}></div> 
		</div>
	</div>
</div>



<div id="dropDownSelect1"></div>
</>

)
}

export default Login

My login.js not work and I can not login user

Take a look at the API documentation:
https://backendless.com/docs/rest/users_login.html

You will see the following:

Now let’s take a look at your code:
1000 Error - REST - Backendless Support 2021-12-04 20-05-35

Notice anything wrong with it?

Your code will produce the following body:

{
  "email": "some-email-value",
  "password": "password-value"
}

And this is not what the API expects to be.

Regards,
Mark

I ask for form-login change email with login

name= email
name=login

Your code is wrong, it doesn’t conform to the required API body structure

1 Like

input id=“first-name” className=“input100” type=“text” name=“login” placeholder=“User loginl”

correct form input

I change my code
export const loginIn = (login, password)=>{

return  fetch(`${baseUrl}/users/login`,{

    method:'POST',

    headers:{

        'content-type': 'application/json'

 },

   body:JSON.stringify({login, password})

}).then(res=> res.json()).then(err=>console.error(err))

}

login.js

import { Link } from “react-router-dom”

import { useHistory } from “react-router”;

import background from “./…/…/…/…/images/image1.jpg”

import * as authService from “…/…/…/…/services/authService”

import { useContext,useState} from ‘react’;

import { AuthContext } from “…/…/…/…/contexts/AuthContext”

// import {login} from “…/…/…/…/firebase”

function Login(){

const { loginUser } = useContext(AuthContext);

//  const { currentUser} = useContext(AuthContext);

 const [loading, setloading] = useState(false);

const historyLogin = useHistory()

// const emailRef = useRef();

// const passwordRef = useRef();

   

//   async function onLoginHandler(e){

//  e.preventDefault();

//      try{

//       setloading(true);

//      await login(emailRef.current.value, passwordRef.current.value)

                       

//      historyLogin.push("/themes");

         

//      }catch{

//          alert('Error!')

//      }

//      setloading(false);

// }

const onLoginHandler = (e) => {

    e.preventDefault();

    let formData = new FormData(e.currentTarget);

    let login = formData.get('login');

    let password = formData.get('password');

    console.log(login);

    console.log(password)

      authService.loginIn(login, password)

         .then((authData) => {

             loginUser(authData);

       

             historyLogin.push("/themes");

       

            })      

        .catch(err => {

             // TODO: show notification

           console.log(err);

       });

}

return(

<>

    <div className="container-login100">

        <div className="wrap-login100">

            <form className="login100-form validate-form" onSubmit={onLoginHandler} method="POST">

                <span className="login100-form-title p-b-34">

                    Account Login

                </span>

               

                <div className="wrap-input100 rs1-wrap-input100 validate-input m-b-20" data-validate="Type user name">

                    <input id="first-name" className="input100" type="text" name="login" placeholder="User email"/>

                    <span className="focus-input100"></span>

                </div>

                <div className="wrap-input100 rs2-wrap-input100 validate-input m-b-20" data-validate="Type password">

                    <input className="input100" type="password" name="password" placeholder="Password"/>

                    <span className="focus-input100"></span>

                </div>

               

                <div className="container-login100-form-btn">

                    <button className="login100-form-btn">

                        Sign in

                    </button>

                </div>

                <div className="w-full text-center">

                    <Link to="/register" className="txt3">

                        Sign Up

                    </Link>

                </div>

            </form>

            <div className="login100-more" style={{backgroundImage: `url(${background})`}}></div>

        </div>

    </div>

</div>

   

<div id="dropDownSelect1"></div>

</>

)

}

export default Login

register ok but
same not work login

Postman
https://xxxx.backendless.app/api/users/login

{

“login”:“sad@abv.bg”,

“password”:“12345678”

}
test not work

authService.js:22 POST https://stronglove.backendless.app/api/users/login 401 (Unauthorized)
{code: 3003, message: ‘Invalid login or password’, errorData: {…}}

I ask login but mistake(error)

  1. Request URL:

https://xxx.backendless.app/api/users/login

  1. Request Method:

POST

  1. Status Code:

401 Unauthorized

  1. Remote Address:

178.32.127.114:443

  1. Referrer Policy:

strict-origin-when-cross-origin