Please provide the following:
- SDK Version: “expo”: “~38.0.8”
- Platforms(Android/iOS/web/all): Android/iOS
Hello, I have been trying to perform an authentication, performing a “fetch”.
I have had the following error:
Object {
“error”: “unauthorized”,
“error_description”: “Full authentication is required to access this resource”,
}
This is my code:
userLogin = () => {
var data = new FormData();
data.append('grant_type', 'password')
data.append('username',this.state.username)
data.append('password',this.state.password)
const url = 'http://64.225.***.***:8080/oauth/token';
const credentials = md5("angularapp" + ":" + "12345")
fetch( url ,{
method: 'POST',
headers: {
'Authorization': 'Basic YW5ndWxhcmFwcDoxMjM0NQ==' + credentials,
'Content-Type': 'application/x-wwww-form-urlencoded',
'Accept': 'application/json',
'Accept-Encoding': 'gzip, deflate, br',
'Connection': 'keep-alive'
},
body: JSON.stringify(data)
}) .then((response) => response.json())
.then((responseData) => {
console.log(responseData);
})
.catch((err) => { console.log(err);
});
}
I did the same request in Postman and there is working.
Any ideas?
Thanks.