I am trying to get the image from the following url : https://mangatown.secure.footprint.net/store/manga/8921/cover.jpg?token=83a7fa7598faf5b7aae40e3c935e0cd95a019adc&ttl=1521921600&v=1521696105
But I only get an empty result,
I tried to use the technique to fetch the url in order to change it into base64 and inject the base64 as an image but couldn't make the fetch worked.
fetch("https://mangatown.secure.footprint.net/store/manga/8921/cover.jpg", {
method: 'GET',
headers: {
'token': '83a7fa7598faf5b7aae40e3c935e0cd95a019adc',
'ttl':'1521921600',
'v':"1521696105"
}
}
).then((res) => res.text())
.then((content) => {
this.setState({
base64: content
})
})
.catch(err => console.log(err))
But only get this error :
TypeError: Network request failed
at XMLHttpRequest.xhr.onerror (fetch.js:441)
at XMLHttpRequest.dispatchEvent (event-target.js:172)
at XMLHttpRequest.setReadyState (XMLHttpRequest.js:554)
at XMLHttpRequest.__didCompleteResponse (XMLHttpRequest.js:387)
at XMLHttpRequest.js:493
at RCTDeviceEventEmitter.emit (EventEmitter.js:181)
at MessageQueue.__callFunction (MessageQueue.js:353)
at MessageQueue.js:118
at MessageQueue.__guardSafe (MessageQueue.js:316)
at MessageQueue.callFunctionReturnFlushedQueue (MessageQueue.js:117)
(like described here : React Native Image with 'Bearer' authentication token )
Does anyone knows the way to make it works with this kind of Authentication image ?
My code is simple :
<Image style={{width:300, height:300}} resizeMode="contain" source={{ uri: https://mangatown.secure.footprint.net/store/manga/8921/cover.jpg?token=83a7fa7598faf5b7aae40e3c935e0cd95a019adc&ttl=1521921600&v=1521696105 }} />
And a same code without token works perfectly :
<Image style={{width:300, height:300}} resizeMode="contain" source={{ uri: "https://demo.phpgang.com/crop-images/demo_files/pool.jpg" }} />
Thanks a lot