keikaavousi/fake-store-api

Login no working

Gw0zdziu opened this issue · 1 comments

Login no working

@Gw0zdziu I faced the same issue solved by adding headers in a POST request
here is my code

fetch("https://fakestoreapi.com/auth/login", {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        username: "mor_2314",
        password: "83r5^_",
      }),
    })
      .then((res) => res.json())
      .then((json) => console.log(json)); 

Hope this will help, Happy coding 😊