0

I have a private container in a storage account that i can access with the help of Azure AD bearer token.

I have to pass a bearer token to my blob storage in order to get the data.

postman

I use these images in a text editor component called 'Quilljs' that parses text and images into raw html content.

The image url itself will be saved in an <img src="url">, but since i cannot put an authorization header in that url itself. I will get a 404 back.

My idea is to make an REST endpoint in my backend that can build that request with the authorization header for me and relay the data back. The problem is that i don't know if i can override the moment the tries to get his data from that url.

Can i perhaps make a rest call in an tag src url?

What are my options here?

I tried using SAS Tokens but since the token itself is different every time it renews, i cannot save that url into my database.

Clumpsypenguin
  • 311
  • 5
  • 19

1 Answers1

1

A 404 error occures when there is no resource for the request that you are making. You can have a detailed look HERE.

You can pass access_token parameter from url using:

https://base.url?access_token=f4f4994a875f461ca4d7708b9e027df4

Here is a similar SO Thread that you can refer to.

While I was hitting through postman I could able to retrieve the blob that I am requesting for. The same url I used in img tag which gave me the same result.

More References : javascript - How to add image in Quill JS? - Stack Overflow

SwethaKandikonda
  • 7,513
  • 2
  • 4
  • 18
  • Hi thank you for the answer since i asked this 2 weeks ago, i kinda moved on and landed on something similar. https://learn.microsoft.com/en-us/rest/api/storageservices/authorize-with-shared-key – Clumpsypenguin Sep 15 '21 at 05:49
  • I put the hashed signature into my url and that returns an image. – Clumpsypenguin Sep 15 '21 at 05:50
  • While an access key is not ideal, my PM insisted on using it instead of Azure AD, since this is my last week at my current employer it did not question it and just went with it. I know it would be more secure when the existing azure AD flow would be used for the authentication as well.... – Clumpsypenguin Sep 15 '21 at 05:52