Skip to main content

Is it possible to add a box.com audio file to another website using the HTML audio tag?

 

here is what I am trying to do:

 


https://app.box.com/v/..../file/1815369463" type="audio/mp3"> Your browser does not support the audio tag.


Hi ,


 


There is one approach that I would probably look into here to see if it can work. Simply providing a shared link to a file, or the like, won't work. What you need is a fully qualified, authorized URI, to fetch the file. We can do that by using the file download API endpoint, then supply an access token in the query string parameters. Essentially the URI would look something like this (which is what you would put in the src):


 


https://api.box.com/2.0/files/${fileId}/content?access_token=${token}

You would supply the file ID and the token in there. 


 


The token itself can be any of the available sources that is scoped to access that file, such as:


  1. An access token from the OAuth 2 process c guides here ]

  2. A developer token generated from the developer console s guide here

That should get you what you need, but you'll need to manage that token as it'll only be good for an hour before needing to be refreshed. 


 


- Jon



Reply