nextcloud-filelink icon indicating copy to clipboard operation
nextcloud-filelink copied to clipboard

Unable to authenticate with Owncloud

Open kyak opened this issue 5 years ago • 12 comments

Bug report

Steps to reproduce

  1. Try to set up Filelink.

Expected behaviour

Account should be set up and quota information should appear.

Actual behaviour

Account has been added, but "Your authorization is required in order to see the settings for this storage service".

When clicking the "Authorize" button, I'm able to enter the password, but the message "Your authorization is required in order to see the settings for this storage service" is still there.

I see the following messages in the terminal while trying to set up the account:

2018-11-08 09:44:04 Nextcloud ERROR Could not retrieve password 2018-11-08 09:44:04 Nextcloud ERROR TypeError: docResponse.ocs.data.quota is undefined 2018-11-08 09:44:19 Nextcloud ERROR TypeError: docResponse.ocs.data.quota is undefined

When trying to attach a file using this account, I get "Unable to authenticate to X" and the "TypeError: docResponse.ocs.data.quota is undefined" message in terminal.

Weirdly, the Mail-attachments folder has been created in my storage. I also see that "Thunderbird" was able to login in my account (Settings - Security - Session in Owncloud).

It doesn't matter if I use my main password or an App password. I don't use 2 FA.

Server configuration

Operating system: Some kind of Linux (sorry I don't own it).

Nextcloud version: ownCloud 10.0.8 (stable)

Updated from an older installation or fresh install: Fresh install

Desktop configuration

Operating system: Arch Linux

Thunderbird version: 60.3.0

Nextcloud-link version: 1.8

Updated from an older installation or fresh install: Updated

kyak avatar Nov 08 '18 06:11 kyak

I guess, we had that issue just yesterday: https://github.com/nextcloud/nextcloud-filelink/issues/64#issuecomment-436644238

creopard avatar Nov 08 '18 08:11 creopard

That's probably something else. My password is longer than 11 characters. One thing, though. My username contains spaces (don't even ask why :( ). Could it be an issue?

kyak avatar Nov 08 '18 14:11 kyak

The URL scheme for getting the quota info is different for owncloud 10.10 it is like this: https://server.de/ocs/v1.php/cloud/users/username?format=json

For nextcloud: https://server.de/ocs/v1.php/cloud/user/?format=json

Both of them need auth, of course.

I think it would be only a small change do distinguish betwewn owncloud and nextcloud. A "BOTHcloud-filelink" would be nice. :)

michaelletzgus avatar Nov 10 '18 21:11 michaelletzgus

Maybe it could try nextcloud url first, and if it doesn't work, fall back to owncloud.

kyak avatar Nov 11 '18 07:11 kyak

Hi, I've tried to update source code to match the URL scheme described by michaelletzgus. Now, the account is successfully added to Thunderbird, with quota display.

But linking attachment when composing mail does not works : the file is successfully uploaded to owncloud but in Thunderbird a popup say "Impossible to upload "file" to "provider" (with "file" and "provider" according to the account, obviously).

I can provides logs if needed.

bastien30 avatar Nov 13 '18 12:11 bastien30

One thing, though. My username contains spaces (don't even ask why :( ). Could it be an issue?

@kyak Filelink currently does NOT work with spaces in the user name, see https://github.com/nextcloud/nextcloud-filelink/issues/32

creopard avatar Nov 13 '18 13:11 creopard

I got it to works, here is the changes I've done into nsNextcloud.js file :

--- nextcloud_for_filelink-1.8-tb/components/nsNextcloud.js    2018-09-25 14:45:12.000000000 +0200
+++ nextcloud_for_filelink-1.8-tb-modified/components/nsNextcloud.js     2018-11-13 14:25:29.915336400 +0100
@@ -38,7 +38,7 @@ Cu.import("resource:///modules/cloudFile
 Cu.importGlobalProperties(["XMLHttpRequest"]);

 const kRestBase = "/ocs/v1.php";
-const kAuthPath = kRestBase + "/cloud/user";
+const kAuthPath = kRestBase + "/cloud/users/";
 const kShareApp = kRestBase + "/apps/files_sharing/api/v1/shares";
 const kWebDavPath = "/remote.php/webdav";

@@ -439,7 +439,7 @@ Nextcloud.prototype = {

                this.log.info("Sending login information...");

-               let args = "?format=json";
+               let args = this._userName + "?format=json";
                let req = new XMLHttpRequest(Ci.nsIXMLHttpRequest);

                req.open("GET", this._fullUrl + kAuthPath + args, true);
@@ -573,7 +573,7 @@ Nextcloud.prototype = {
                }


-               let args = "?format=json";
+               let args = this._userName + "?format=json";
                let req = new XMLHttpRequest(Ci.nsIXMLHttpRequest);

                req.open("GET", this._fullUrl + kAuthPath + args, true);

bastien30 avatar Nov 13 '18 13:11 bastien30

So there are at least two problems here.

@creopard thanks for the hint; I'll work it out how to change my username. @bastien30 nice, but do I understand correctly that this patch won't be accepted because it will break things for nextcloud users?

kyak avatar Nov 13 '18 14:11 kyak

@bastien30 nice, but do I understand correctly that this patch won't be accepted because it will break things for nextcloud users?

Yes you understand correctly, I've just provided the changes I've done to make the extension works with Owncloud, but it breaks compatibility with Nextcloud. It's just to have a workaround solution until the extension is updated.

bastien30 avatar Nov 13 '18 15:11 bastien30

I'm using https://server.de/ocs/v1.php/cloud/users/username?format=json only in _getUserInfo: function nsNc_getUserInfo (successCallback, failureCallback)

The logon function logon: function nsNc_logon (successCallback, failureCallback, aWithUI) works as it is for both, ownclod (sciebo) and nextcloud.

Michael

michaelletzgus avatar Nov 17 '18 10:11 michaelletzgus

Accidentally committed to master, please check...

michaelletzgus avatar Nov 18 '18 12:11 michaelletzgus

@michaelletzgus I've tried this commit https://github.com/nextcloud/nextcloud-filelink/commit/28d2a9bf8576a4e59941f63399d18bddc25b4d12 and it works fine with Owncloud!

Thank you!

kyak avatar Nov 20 '18 04:11 kyak