on-internet
← Community

Image not loading in react native having bearer token authentication

Stack Overflow ·

I am having my images on a secure server. For authentication, I should provide a bearer token. If I pass it using the below format I am getting a blank image. <Image source={ { uri: 'https://yourdomain.com/get-image', headers: { Authorization: 'Bearer xyz' } } }/> When I have checked error code onError prop in Image source it has "nativeEvent": {"error": "Unexpected HTTP code 403"} I have tested the request in postman it is working without any issues.(I am able to see the image) The token is valid. Edit1: Sending an XMLHttpRequest and taking the byte array and converting it into Base64 works j

Comments

Sign in or sign up to comment and upvote.

No comments yet.