I am sending an Ajax-GET-requests using basic auth:
$.ajax({
type: "GET",
url: url,
beforeSend: function(xhr){
xhr.setRequestHeader( "Authorization", "Basic "+btoa("username:password"));
xhr.setRequestHeader( "Accept", "application/json" );
},
success: function(data){
console.warn(data);
}
});
This is working perfectly fine - but do I have to send the username/password on every request?
This would mean, that I have to ask the user for his username/password on every request / or store it in Javascript, which is not very safe.
Is there any way to send the username/password only once, even for multiple requests?
Thank you very much!