Using jQuery, I call the Version One Rest API and must authenticate the user in the HTTP header.
I tried
$.ajax({ dataType: "jsonp", beforeSend: function(xhr){ xhr.setRequestHeader("Authorization", "Basic xyz"); // xyz usr:pwd Base64 encoded }, url: "https://www10.v1host.com/.../VersionOne/rest-1.v1/...", success: function(data, status, xhr) { alert("Load was performed."); } });
and
$.ajax({ dataType: "jsonp", username:"usr", password:"pwd", url: "https://www10.v1host.com/.../VersionOne/rest-1.v1/...", success: function(data, status, xhr) { alert("Load was performed."); } });
But I always pop up asking for my credentials (I use Chrome). Even when I enter the credentials in a popup, I am not authenticated and the window continues to show.
- How to authenticate a user using jQuery in HTTP headers?
- Is there a way to make the encrypted password invisible? Or Base64 is the only way. I want to access the server through only one account, but I do not want users on the client side to see the password (or find it in javascripts).
padis
source share