Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Pass Authorization Header in HTTP Request when using HTML5 Player (Audio tag) for security

i am using HTML5 audio player as follows :

<audio controls>
  <source src="<url>" type="audio/mp3">
</audio>

Now , i want to secure my app , So i want to pass some sessionId in Header parameter in http request for mp3 .

I could not find any way to do this , Please help if anyone knows the solution .

or

Is there any other player which gives this support ? ? ?

like image 928
Sahil Aggarwal Avatar asked Dec 16 '17 12:12

Sahil Aggarwal


People also ask

How do I pass the Authorization header in GET request?

To send a GET request with a Bearer Token authorization header, you need to make an HTTP GET request and provide your Bearer Token with the Authorization: Bearer {token} HTTP header.

How do I pass the Authorization header in post?

To send a POST JSON request with a Bearer Token authorization header, you need to make an HTTP POST request, provide your Bearer Token with an Authorization: Bearer {token} HTTP header and give the JSON data in the body of the POST message.

How do I send Authorization header in URL?

To send a request with the Bearer Token authorization header, you need to make an HTTP request and provide your Bearer Token with the "Authorization: Bearer {token}" header. A Bearer Token is a cryptic string typically generated by the server in response to a login request.

Does browser automatically send Authorization header?

The HTTP Authorization request header can be used to provide credentials that authenticate a user agent with a server, allowing access to a protected resource. The Authorization header is usually, but not always, sent after the user agent first attempts to request a protected resource without credentials.


1 Answers

I think you should use HTMLAudioElement and play audio from javascript instead of html directly. Now when you use javascript you can use secured urls to fetch the audio file and provide it to the Audio Element. This might work for you.

like image 97
sameepsi Avatar answered Sep 20 '22 12:09

sameepsi