I am trying to make a login page with a react native frontend and a django-rest-auth backend, but when I send my request:
`login = () => {
fetch('http://myIp/rest-auth/login/', {
method: 'POST',
header: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
username: this.state.username,
password: this.state.password,
})
})
.then((response) => response.json())
.then((res) => {
if (res.success === true) {
AsyncStorage.setItem('user', res.user)
this.props.navigation.navigate('Profile')
}
else {
alert(res.message)
}
})
}
}`
My backend returns:
Unsupported Media Type
I only use django-rest-auth api endpoints. What is the problem ? Thank you for your help ;D