diff --git a/lib/api.php b/lib/api.php
index cb67e0c2a892f33305e7e74b1146dc4dd50b1f8d..da0c2417dcf1cab7a08cb3b126190416fe872b5c 100644
--- a/lib/api.php
+++ b/lib/api.php
@@ -94,6 +94,8 @@ class OC_API {
 				$response = new OC_OCS_Result(null, 998, 'Api method not found');
 			} 
 		} else {
+			 header('WWW-Authenticate: Basic realm="Authorisation Required"');
+			 header('HTTP/1.0 401 Unauthorized');
 			$response = new OC_OCS_Result(null, 997, 'Unauthorised');
 		}
 		// Send the response