ich ein Video von einem API bin anfordert, die JWT Web-Token benötigt:AJAX: JWT Auth für Video-Last über src
// when the ajax call is done (the tolken is recieved)
getAccessToken.done(function(data) {
var d = JSON.stringify({'fpath': fpath})
// get the download url
var downloadurl = $.ajax({
type: "POST",
url: "https://gcp.inbcu.com/download",
beforeSend: function(xhr){
xhr.setRequestHeader("Authorization", "JWT " + data.access_token);
},
contentType: 'application/json',
data: d,
success: function(response){
$('#video-source').attr('src', response.url)
$('#myvideo').load()
},
error:function(jqXHR, textStatus, errorThrown) {
console.log("request for download url failed: ", textStatus, errorThrown, jqXHR);
},
dataType: 'json'
});
Diese Ajax-Aufruf selbst erfolgreich ist (200) und gibt die richtigen Werte. Hauptsächlich gibt es eine URL zurück, um die Quelle des Videos festzulegen.
Problem ist, das Video src
versucht, auf die URL zuzugreifen und hat keine Berechtigung (kein JWT-Token/Autorisierung). Wie soll ich das Video mit der richtigen Berechtigung laden, wenn ich den Quellcode eines Videos lade? Ist das möglich?