I have an old Wordpress site. I installed the plugin JWT Auth so my React Native app can authenticate users from this website.
I have this React code:
function LoginScreen({navigation}) {
const [username, setUsername] = React.useState('')
const [password, setPassword] = React.useState('')
const apiurl = 'https://wordpresswebsite.com/wp-json/jwt-auth/v1/token/'
function submitLogin() {
axios.post(apiurl, {
body: JSON.stringify({ username: username, password: password })
})
.then(function(response) {
console.log(response)
})
.catch(function(err) {
console.log(err)
})
}
}
The response I get is code: "jwt_auth_no_auth_header"
However, when I use Postman, I get the expected "code":"jwt_auth_valid_credential" without any problems.
What is going on here and how can I get the result like in Postman?