- Joined
- Sep 20, 2018
- Messages
- 24,393
- SLU Posts
- 18459
This is for something I'm making in-world, using shared media, which is making it rather tricky to debug.
When I reference an image url on a remote server, I need to send a token as the header, which is something I've never done before. After a bit of poking around online, I've come up with this
and I then want to use imageURL in the page.
This isn't working, and I think the problem must be here, because the page works when I don't need to send a credential.
Any suggestions, anyone? I can't readily debug it in Firefox because the token was issued to my inworld object, not my PC.
ETA
I'm trying to use it in this (escaped for LSL)
where strSampleURL is one I've been sent by a remote server. However, I can use strSampleURL only when I send a token in the header, so I somehow have to get the token in that bit of code.
How do I make imageURL do what strSampleURL does now?
When I reference an image url on a remote server, I need to send a token as the header, which is something I've never done before. After a bit of poking around online, I've come up with this
JavaScript:
<script>
//<![CDATA[
let imageUrl;
fetch('https:someUrl', {
headers: {
'Authorization': 'Bearer MY_TOKEN'
}
})
.then(response => {
return response.blob();
})
.then(imageBlob => {
imageUrl = URL.createObjectURL(imageBlob);
const img = document.createElement('img');
img.src = imageUrl;
document.body.appendChild(img);
});
//]]>
</script>
This isn't working, and I think the problem must be here, because the page works when I don't need to send a credential.
Any suggestions, anyone? I can't readily debug it in Firefox because the token was issued to my inworld object, not my PC.
ETA
I'm trying to use it in this (escaped for LSL)
Code:
background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url("+strSampleURL+");
How do I make imageURL do what strSampleURL does now?
Last edited: