I use facebook login via django-rest-auth and react to native.
I installed facebook sdk correctly and was able to get the access token, but when I try to send it to the backend, it gives me a Bad Request error.
After debugging, I found that no data was sent to the server.
I thought this could be due to CORS as the application is in localhost: 8001 and django in localhost: 8000, but I installed django-cors-headers and still no data was sent.
Please help me here .. here is the code for the query request.
fetch(loginUrl, {
method: 'post',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({
data:'ahahah'
})
})
.then((response) => {
alert(response)
})
.catch((error) => {
alert(error)
})