ZJL ZJL - 6 months ago 105
Javascript Question

How do I get network images with authentication in React Native?

The current supported way to get image is by inserting the {uri:link} object to the source props of Image, however, this does not have authentication enabled. Is there a way to insert an authentication token into the url call or other ways to have authentication for retrieving images? Thanks a lot!

< Image
source={{uri: 'http://facebook.github.io/react/img/logo_og.png'}}


Are you using basic auth as your question tag suggests? If yes, you could bake it into the URL itself:

    source={{uri: 'https://USER:PASSWORD@facebook.github.io/react/img/logo_og.png'}}