Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 400 Bad Request Question #27

Open
davStar opened this issue Jun 9, 2020 · 2 comments
Open

Error 400 Bad Request Question #27

davStar opened this issue Jun 9, 2020 · 2 comments

Comments

@davStar
Copy link

davStar commented Jun 9, 2020

Hello json-server-auth team,

Context:
Receive 400 error so I can understand I send a bad request. However seems everything fine in my side. So please tell me if I miss something.

My log track the following output:
POST /login 400 1.362 ms - 20

Code:
Request API url :

`
const authEndpoint = "http://localhost:3000/login"

fetch(authEndpoint, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',

  },
  body: JSON.stringify({
    email: this.state.email,
    password: this.state.password,
  }),
}).then((response) => {
  console.log(response.status)
  response.status})
  .catch((error) => {
    console.error(error);
 });`

My db.json config file:

`
{
"signal": [
{ "id": 1, "category": "Fuite d'eau", "user": "david@gmail.com", "description": "Fuite d'eau issuen de l'étage 2" }
],

"login":[
    {"email": "test@test.com", "name": "David", "lastname": "M", "password":"test"},
    {"email": "david@gmail.com", "name": "David", "lastname": "M", "password":"weloveyou"},
    {"email": "remi@test",  "name": "Remi", "lastname": "P", "password":"weloveyou"},
    {"email": "thomas@test",  "name": "Thomas", "lastname": "S", "password":"weloveyou"}


]

}
`

@davStar davStar changed the title Error 400 Url is malformed Error 400 Bad Request Question Jun 9, 2020
@cristofersousa
Copy link

+1

1 similar comment
@ecureuill
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants