I'm using react-native
0.51.0. I have dozens of pages(components) where I make GET
, POST
requests. All works perfectly, except one of them. It seems, Authorization
header does not pass during the call.
My request options are like
requestOptions = {
method: 'GET',
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer ' + this.props.token
}
};
I get "Token not provided
" error message when I run the code, but I try same token, exactly same request options through postman
and it works perfectly.
I surfed through lots of questions, issues and tried lots of suggested solutions like adding
access-control-allow-origin
credentials: 'same-origin
credentials: 'include'
But nothing changed.. I'm sure my token is true and not expired. Lots of suggestions are related with CORS thing. But what I do not understand, if true then why all other fetch
methods work ? I call all http requests to the same server.