So i have this project to access my ip cam stream through a website, but my camera interface has a header basic authentication.
I tried to use user credentials in my url but it doesnt work :
http://username:password@192.168.my-ip/
Also my password contains "@" so i encoded them with %40 and tried %2540 (for the encoding of %) too, doesnt work either.
I saw that maybe a JS post request like this could do the trick but i don't know where to find the clientSecret :
var clientId = "MyApp";
var clientSecret = "MySecret";
// var authorizationBasic = $.base64.btoa(clientId + ':' + clientSecret);
var authorizationBasic = window.btoa(clientId + ':' + clientSecret);
var request = new XMLHttpRequest();
request.open('POST', oAuth.AuthorizationServer, true);
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
request.setRequestHeader('Authorization', 'Basic ' + authorizationBasic);
request.setRequestHeader('Accept', 'application/json');
request.send("username=John&password=Smith&grant_type=password");
request.onreadystatechange = function () {
if (request.readyState === 4) {
alert(request.responseText);
}
};