Ret*_*n-1 1 react-native react-native-image
我为我的应用程序使用了基于会话的身份验证系统,但是我的API调用工作得很好,但是,当使用以下请求图像时:
<Image source={{uri: 'https://facebook.github.io/react/logo-og.png'}}
style={{width: 400, height: 400}} />
Run Code Online (Sandbox Code Playgroud)
该请求未通过身份验证
但是,需要身份验证才能检索图像。您将如何处理?似乎没有关于此的任何文档
您可以通过Image source 传递标题:
<Image source={{
uri: 'https://facebook.github.io/react/logo-og.png',
headers: {
Cookie: 'cookie data here',
}
}}>
Run Code Online (Sandbox Code Playgroud)
从API响应中获取Cookie:
fetch('apicall').then(res => {
cookieData = res.headers.map["set-cookie"];
})
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
551 次 |
| 最近记录: |