I am creating an application that is mentioned to connect to an instance of on owncloud server but i can't find why it doesn't connect to the server .Instead of that the reply i get to the login screen and i get the html code for it

this is the code responsible for the connection
Qt Code:
  1. //the network request and reply
  2. QNetworkAccessManager * manager = new QNetworkAccessManager();
  3. QUrl url (url1);
  4. manager->get(QNetworkRequest(url));
  5. connect(manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),
  6. SLOT(provideAuthenication(QNetworkReply*,QAuthenticator*)));
  7. connect(manager, SIGNAL(finished(QNetworkReply *)),
  8. this, SLOT(result(QNetworkReply *)));
To copy to clipboard, switch view to plain text mode 

the reply code:
Qt Code:
  1. void Login::result(QNetworkReply *reply)
  2. {
  3. reply->deleteLater();
  4.  
  5. if(reply->error() == QNetworkReply::NoError) {
  6. // Get the http status code
  7. int v = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
  8. if (v >= 200 && v < 300) // Success
  9. {
  10. qDebug()<<"Here we got the final reply";
  11. QString replyText = reply->readAll();
  12. qDebug()<<replyText;
  13. }
  14. else if (v >= 300 && v < 400) // Redirection
  15. {
  16. qDebug()<<"Get the redirection url";
  17. QUrl newUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
  18. // Because the redirection url can be relative,
  19. // we have to use the previous one to resolve it
  20. newUrl = reply->url().resolved(newUrl);
  21.  
  22. QNetworkAccessManager *manager = reply->manager();
  23. QNetworkRequest redirection(newUrl);
  24. QNetworkReply *newReply = manager->get(redirection);
  25. QString replyText = newReply->readAll();
  26. qDebug()<<replyText;
  27. return; // to keep the manager for the next request
  28. }
  29. }
  30. else
  31. {
  32. // Error
  33. qDebug()<<reply->errorString();
  34. }
  35.  
  36. reply->manager()->deleteLater();
  37. }
To copy to clipboard, switch view to plain text mode 
could you help me figure out why i get the login screen instead of authentication ?