Json web token + img src

I installed my json web project authentication authentication. I requested all requests on the path "private". What is the best way to download an image from a client using the img tag and the src attribute.

<img src="/private/test.jpg" /> 

The only solution I have so far is to install a coookie on the client with a token value, and instead of private access to the public path. Then on the server I will receive a cookie value and make a new request with the correct set of tokens in the header in relation to my private path.

Is there a more elegant way?

+6
source share

Source: https://habr.com/ru/post/981670/


All Articles