Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to authenticate with Owncloud #65

Open
kyak opened this issue Nov 8, 2018 · 12 comments
Open

Unable to authenticate with Owncloud #65

kyak opened this issue Nov 8, 2018 · 12 comments

Comments

@kyak
Copy link

kyak commented Nov 8, 2018

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

@creopard
Copy link

creopard commented Nov 8, 2018

I guess, we had that issue just yesterday: #64 (comment)

@kyak
Copy link
Author

kyak commented Nov 8, 2018

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?

@michaelletzgus
Copy link
Contributor

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. :)

@kyak
Copy link
Author

kyak commented Nov 11, 2018

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

@bastien30
Copy link

bastien30 commented Nov 13, 2018

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.

@creopard
Copy link

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 #32

@bastien30
Copy link

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);

@kyak
Copy link
Author

kyak commented Nov 13, 2018

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?

@bastien30
Copy link

bastien30 commented Nov 13, 2018

@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.

@michaelletzgus
Copy link
Contributor

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 added a commit that referenced this issue Nov 18, 2018
See #65
Change path for retrieving userinfo from "/cloud/user" to "/cloud/users/USERNAME"
@michaelletzgus
Copy link
Contributor

Accidentally committed to master, please check...

michaelletzgus added a commit that referenced this issue Nov 18, 2018
See #65
Change path for retrieving userinfo from "/cloud/user" to "/cloud/users/USERNAME"
@kyak
Copy link
Author

kyak commented Nov 20, 2018

@michaelletzgus I've tried this commit 28d2a9b and it works fine with Owncloud!

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants