Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
32
rated 0 times [  35] [ 3]  / answers: 1 / hits: 68334  / 7 Years ago, mon, october 9, 2017, 12:00:00

I have an api that uses jwt for authencation. I am using this api for a vuejs app. I am trying to display an image in the app using



<img src=my/api/link />


But the api expects Authorization header with jwt token in it.



Can I add headers to browser request like this(Answer to few questions here has made me believe it's not possible)?



Is there any way around it(using js) or should i change the api itself?


More From » html

 Answers
94

You can not perform authentication on images which are directly used as href in img tag. If you really want this type of authentication on your images, then it's better to fetch them using ajax and then embed in your html.


[#56278] Thursday, October 5, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
julian

Total Points: 159
Total Questions: 105
Total Answers: 94

Location: Chad
Member since Mon, Dec 5, 2022
2 Years ago
;