Load html <img> with jwt-token included

Im using reactjs in a project. I have this "image server" (asp net core web api with an authorize-attribute) so it requires a jwt-token.

public async Task<FileStreamResult> GetImage(string galleryShortName, string fileName) {...}

Is there any way I can send my access token with calls from server in my -tags?

This article seems to do this with angular pipes. I cant say that I understand 100% of the article, I dont speak Angular, but is there any way to sneak in a token in the requests.

Another alternative would be have placeholder imgs, and to load the imagedata with fetch(using auth header), but how do I put them in the placeholders?

Any other suggestions are welcome how to do this are welcome?

Read more here: https://stackoverflow.com/questions/66273218/load-html-img-with-jwt-token-included

Content Attribution

This content was originally published by Cowborg at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: