Problem with HTTP request on Android (401)

plugins
android

#1

Hey guys. So I’m currently building an app and on my login page I make a HTTP request to my API endpoint, which checks if the user is registered or not.
It all works fine on iOS but not on Android for some reason. Here’s the request code(I have to remove the url for security reasons). Any help or idea would be very much appreciated. Thanks

 http.request({
				url: "http://endpoint/api/checkcredentials",
				method: "POST",
				headers: { "Content-Type": "application/x-www-form-urlencoded" },
				content: `username=${credentials.mail}&psw=${credentials.pass}`
			}).then(function(response) {
				try {
					//parse JSON object to access info
					console.log("Got a response from the server")
					let res = JSON.parse(response.content);
					console.log(response.content);
					
				   
					//perform check
					if (res.result == true ) {
						//if the user is registered redirect him to his feed(timeline)
						const topmost = frameModule.topmost();
						   const navigationEntry = {
								 moduleName: 'views/amici/amici2/amici2',
								 context: { user_id: res.user_info.Id },
							 clearHistory: true,
						 };

							topmost.navigate(navigationEntry);
							} else {
							 
							alert({title: "Acceso non riuscito", message: "Credenziali non valide.\nRiprova!", okButtonText: "OK"});
							 
							}
				} catch (e) {
					console.log(e);
				}
			 }, function(error) {
				 console.error(JSON.stringify(error));
			 });