We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Your documentation claims it can work with fetch as bellow:
fetch('https://fakestoreapi.com/auth/login',{ method:'POST', body:JSON.stringify({ username: "mor_2314", password: "83r5^_" }) }) .then(res=>res.json()) .then(json=>console.log(json))
But, when doing so I receive a Uncaught (in promise) SyntaxError: Unexpected token 'u', "username a"... is not valid JSON
Uncaught (in promise) SyntaxError: Unexpected token 'u', "username a"... is not valid JSON
The only way I found to get it to work with fetch is to change the headers to read application/json
let myHeaders = new Headers(); myHeaders.set('Content-Type', 'application/json'); fetch('https://fakestoreapi.com/auth/login', { method: 'POST', // headers: myHeaders, body: JSON.stringify({ username: 'mor_2314', password: '83r5^_', }), }) .then((res) => res.json()) .then((json) => console.log(json));
Not sure if this is an error on the server side or not, but wanted to let you know of the error I was coming up with and the solution I found.
The text was updated successfully, but these errors were encountered:
Okay thank you with the review
Sorry, something went wrong.
was auth feature killed?
@grassfinn hi, did you find a solution? i have the same problem
No branches or pull requests
Your documentation claims it can work with fetch as bellow:
But, when doing so I receive a
Uncaught (in promise) SyntaxError: Unexpected token 'u', "username a"... is not valid JSON
The only way I found to get it to work with fetch is to change the headers to read application/json
Not sure if this is an error on the server side or not, but wanted to let you know of the error I was coming up with and the solution I found.
The text was updated successfully, but these errors were encountered: