React Native JWT-auth Error fetching api
I am trying to fetch user detail by using jwt-auth, by following method.
login() {
alert(this.state.UserName);
fetch (Api+''+'/wp-json/jwt-auth/v1/token',{
method: "POST",
username: this.state.UserName,
password: this.state.Password
}).then((response) => response.json())
.then((responseData) =>{
console.log("LoginData:-" + JSON.stringify(responseData));
}).done();
}
}
and getting error:-
{
"code":"[jwt_auth] empty_username",
"message":"<strong>ERROR</strong>: The username field is empty.",
"data":{"status":403}
}
If anyone Knows Please help.