Owncloud client cannot login

I guess you’ll need to insert it in the DB manually. It should be there anyway.
If you’re using the “default official” desktop client, you can check the ones set in https://github.com/owncloud/client/blob/5cbf60c6f4c3e57cfeb679bee6e9fb28c829a562/src/libsync/theme.cpp (other clients might use different values)

Ok gotcha. I’ll try it.


Ok, definitely making progress!!!

It now allows me to authorize the app. The ownCloud server page now says: The application was authorized successfully. You can now close this window.

But the desktop client doesnt seem to get the message. It simply sits there with the message: “Reopen browser”, but it doesnt continue the setup. If I click Reopen Browser, it starts the authorization process again.

The redirect url is set to http://localhost:* . I would assume thats correct? Whats the next step here?

The correct client id and secret can be found here:

Can you check your database that the values match?

Yes, they match perfectly. That is what I used. I manually updated the database with those values.

The authorization is happening, but the desktop client doesn’t seem to get the message. It simply won’t move forward in the process.

I do have the callback URL as http://localhost:*

What am I missing?

If things match correctly, have a look at the desktop client logs after you made the progress.
Additionally I would recommend to have the log level set to 0 on the owncloud instance, that should give you some more hints what is happening on the server side.
Also check your apache access log that the requests from the client arrive properly at the server

Something funky is definitely going on.

In apache access logs, I see this repeated statement (seems like it keeps retrying but failing with a 401 - Unauthorized):

xxx.xxx.xxx.xxx - - [30/Jun/2019:23:50:27 +0000] “PROPFIND /remote.php/webdav/ HTTP/1.1” 401 1204 “-” “Mozilla/5.0 (Macintosh) mirall/2.5.4 (build 11456)”
xxx.xxx.xxx.xxx - xdXOt13JKxym1B1QcEncf2XDkLAexMBFwiT9j6EfhhHFJhs2KM9jbjTmf8JBXE69 [30/Jun/2019:23:50:28 +0000] “POST /index.php/apps/oauth2/api/v1/token HTTP/1.1” 200 4273 “-” “Mozilla/5.0 (Macintosh) mirall/2.5.4 (build 11456)”
xxx.xxx.xxx.xxx - - [30/Jun/2019:23:50:28 +0000] “GET /ocs/v2.php/apps/notifications/api/v1/notifications?format=json HTTP/1.1” 200 1022 “-” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36”
xxx.xxx.xxx.xxx - - [30/Jun/2019:23:50:28 +0000] “PROPFIND /remote.php/webdav/ HTTP/1.1” 401 1204 “-” “Mozilla/5.0 (Macintosh) mirall/2.5.4 (build 11456)”
xxx.xxx.xxx.xxx - xdXOt13JKxym1B1QcEncf2XDkLAexMBFwiT9j6EfhhHFJhs2KM9jbjTmf8JBXE69 [30/Jun/2019:23:50:28 +0000] “POST /index.php/apps/oauth2/api/v1/token HTTP/1.1” 200 4273 “-” “Mozilla/5.0 (Macintosh) mirall/2.5.4 (build 11456)”

Ho do I turn on the logs on the client side on a mac? I don’t see any options in the owncloud client settings?

The repeated 401 errors only seem to happen while the owncloud client is open. After doing the oauth2 authentication, the client goes back to “Reopen browser”, but a tail -f on the apache access log shows a constant stream of 401 errors like the client keeps retrying. As soon as I close the client window, the 401 errors stop.

So I think now its just resolving the 401 and I got this beat.

Ok, got the client logging working. Seems to be the client-side of the same 401 error. At least that confirms it:

|06-30 20:16:56:409 [ warning sync.credentials.http ]:|Stop request: Authentication failed for  "https://cloud.mycloud.com/remote.php/webdav/"|
|06-30 20:16:56:409 [ info sync.credentials.http ]:|Refreshing token|
|06-30 20:16:56:410 [ info sync.accessmanager ]:|4 "" "https://cloud.mycloud.com/index.php/apps/oauth2/api/v1/token" has X-Request-ID "72435ce9-5c69-4e91-87e4-9bc9b85c8fc1"|
|06-30 20:16:56:410 [ info sync.networkjob ]:|OCC::SimpleNetworkJob created for "https://cloud.mycloud.com" + "" ""|
|06-30 20:16:56:724 [ info sync.networkjob ]:|Restarting "PROPFIND" QUrl("https://cloud.mycloud.com/remote.php/webdav/")|
|06-30 20:16:56:724 [ info sync.accessmanager ]:|6 "PROPFIND" "https://cloud.mycloud.com/remote.php/webdav/" has X-Request-ID "1674f316-22a1-4fd1-8411-4682ce15222d"|
|06-30 20:16:56:846 [ warning sync.credentials.http ]:|Stop request: Authentication failed for  "https://cloud.mycloud.com/remote.php/webdav/"|
|06-30 20:16:56:846 [ info sync.credentials.http ]:|Refreshing token|
|06-30 20:16:56:847 [ info sync.accessmanager ]:|4 "" "https://cloud.mycloud.com/index.php/apps/oauth2/api/v1/token" has X-Request-ID "4b95c1b7-8940-495e-9c8d-43ae71db4bca"|
|06-30 20:16:56:847 [ info sync.networkjob ]:|OCC::SimpleNetworkJob created for "https://cloud.mycloud.com" + "" ""|
|06-30 20:16:57:167 [ info sync.networkjob ]:|Restarting "PROPFIND" QUrl("https://cloud.mycloud.com/remote.php/webdav/")|
|06-30 20:16:57:168 [ info sync.accessmanager ]:|6 "PROPFIND" "https://cloud.mycloud.com/remote.php/webdav/" has X-Request-ID "75a9fa58-fd6b-4991-bb4f-e266f95fd3e7"|


I needed to add this to the Apache config for this vhost:

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

But I don’t understand why. This was working all along and then suddenly stopped working. No configuration changes.

Well, I guess I shouldn’t complain.

Thanks a ton for your help! I really appreciate it!

1 Like


i did the following search https://central.owncloud.org/search?q=“SetEnvIf%20Authorization” and found the following quite old FAQ mentioning that this is required since longer time for the client in “normal” operation:

Maybe this is now also required for Oauth2?

1 Like

Not really sure. But the protocol generally wouldn’t change from one day to the next. Nothing on the server changed, unless it was an updated client (This did start when I installed a new client on a new macbook).

So maybe that new client is now using the updated protocol? Not sure.

Thank you so much @ac1dr41n for sharing how you fixed it. I added it to my apache config and it works fine.

Fort WHM/cpanel web hosters, doing this is both complicated and flexible:

  1. Navigate to /etc/apache2/conf.d/userdata/ssl/2_4/username/FQDN.com (replace username and FQDN with your own information)
  2. Create a file with any name you like. I called mine owncloud_auth.conf (filename must in .conf)
  3. Edit the file and add the one line @ac1dr41n told us about above.
  4. Save the file.
  5. Run this command to rebuild the apache config files (the way WHM works is it compiles all the .conf files in a variety of folders and makes a single apache.conf…this allows each account on the the server to have their own “vhost” file): /usr/local/cpanel/scripts/rebuildhttpdconf
  6. Run this command to restart apache so it can read the new config: /usr/local/cpanel/scripts/restartsrv_httpd

All done!

WHM documentation that discusses the apache config include files and the two commands: https://documentation.cpanel.net/display/EA4/Modify+Apache+Virtual+Hosts+with+Include+Files

Happy synching!

1 Like