Question by
JamesPost · Sep 13, 2017 at 08:41 AM ·
androidurlauthentication
Android URL basic authentication.
Hello, I've hit a wall with URL basic authentication after moving my application from iOS to android. My app loads a 3D model off of an http server which has basic username:password authentication configured. This worked perfectly within iOS by adding the credentials explicitly to the URL (bad practice I know) e.g. http://username:password@someserver.com. I've searched the t'internet for possible solutions but confess to being a newbie for coding solutions other than the simple stuff. My existing code shown below works on iOS; my question - how do I add the name level of authentication to work on android? Thanks in advance!
IEnumerator Load ()
{
var objFileName = "http://username:password@server.name.com/obj/";
loading = true;
if (objData != null && objData.gameObjects != null) {
for (var i = 0; i < objData.gameObjects.Length; i++) {
Destroy (objData.gameObjects [i]);
}
}
objData = ObjReader.use.ConvertFileAsync (objFileName, true, standardMaterial, transparentMaterial);
while (!objData.isDone) {
loadingText.text = (objData.progress * 100).ToString ("f0");
yield return null;
}
loading = false;
if (objData == null || objData.gameObjects == null) {
loadingText.text = "Error loading file";
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612134743im_/https://answers.unity.com/themes/thub/images/avi.jpg)