JavaScript – how to obtain network images with authentication in react native?

Currently, the supported method to get images is to insert {URI: link} objects into the source props of images, but this method does not enable authentication. Is there a method to insert authentication tokens into URL calls, or is there another method to retrieve images through authentication? Thank you.

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

resolvent:

Do you use basic authentication as the recommended token for your problem? If so, you can bake it into the URL itself:

  <Image
    style={styles.logo}
    source={{uri: 'https://USER:PASSWORD@facebook.github.io/react/img/logo_og.png'}}
  />

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>