Stuck in a login loop when logging in from sync client on Linux

I’m having trouble logging into one account from the sync client on Linux.

Two other accounts on a different server work fine.

Another account, on a different server gets stuck in an infinite loop:

  1. “Connect your account” - click login
  2. First time around, enter login details
  3. “Grant access” - click grant access
  4. Goto 1. Skip step 2. on subsequent tries. Loop forever.

Things tried:
*Deliberately enter wrong password. This throws an error, the login is successful.
*Web interface. This login works fine. I can also see that the client is logged in.
*Upgrade NC. Was on 14.0.6, now on 15.0.4. No change
*Remove cookies stored in ~.local/…etc…/Nextcloud
*Remove the account and re-add it
*Closing the login window - this just gets the client stuck on logging in.
*I’m logged in on another linux computer with the same distro and the same version client. Though I am not sure that I actually logged in on this version client - I think the login carried over from an earlier version.
*Version of client is 2.5.1git as packaged in Debian testing.

I really don’t want to nuke nextcloud.cfg, but can.

Any ideas?

Hi,
I had exactly the same problem yesterday with my own nextcloud instance.
When trying to log in from desktop sync client i was getting infinite loop and when trying to log in from nextcloud notes on android, logging in would just time out without any real errors in the log.

Turns out you need to add ‘overwriteprotocol’ ‘overwrite.cli.url’ and ‘overwritehost’ parameters to your config.php file.
Also, my nextcloud instance is running behind nginx proxy, and i had missconfigured ‘trusted_proxies’ parameter.

After adding those overwrite parameters and fixing my trusted_proxies array, i can log back in with the sync client.

1 Like

Hi @DooNa1oh ! Would you be so kind to help me debug my installation? I’m using docker image (port 80) and apache as proxy through https (port 443), details of my setup can be found here Cant connect from desktop client to instance, keeps looping "connect account" page

In my config.php file I have

‘overwrite.cli.url’ => ‘https://cloud.mgscreativa.com.ar’,
‘overwriteprotocol’ => ‘http’,
‘overwritehost’ => ‘cloud.mgscreativa.com.ar’,
‘trusted_proxies’ => array(‘10.0.0.77’),
‘forwarded_for_headers’ => array(‘HTTP_X_FORWARDED’, ‘HTTP_FORWARDED_FOR’),

My proxy config looks like this

<Proxy />
    Allow from localhost
</Proxy>

ProxyPreserveHost On
ProxyPass /.well-known/acme-challenge/ !
ProxyPass / http://lucas.mgscreativa.com.ar:3080/
ProxyPassReverse / http://lucas.mgscreativa.com.ar:3080/

Thanks in advise!

Forget it, just got it working like this

Proxy settings

<Proxy />
  Order deny,allow
  Allow from all
</Proxy>

ProxyPreserveHost On
ProxyPass /.well-known/acme-challenge/ !
ProxyPass / http://lucas.mgscreativa.com.ar:3080/
ProxyPassReverse / http://lucas.mgscreativa.com.ar:3080/

NextCloud config

  'overwrite.cli.url' => 'https://cloud.mgscreativa.com.ar',
  'overwriteprotocol' => 'https',
  'overwritehost' => 'cloud.mgscreativa.com.ar',
  'trusted_proxies' => array('10.0.0.77'),
1 Like

Hi,

I’m still facing issues with NextCloud Linux client. There is any other options to avoid this loop?
I’ve tried all work around without success :frowning:. Is very frustrating…

I’m using NextCloud Server 15.0.5 and Client 2.5.1.

Same here, internal server with no need for ssl at all.
No chance to get 2.5.1 to login, looped forever. I spend some days and:

  • used internal proxy or not (would be nice if it could be configured per account)
  • switched apache to use ssl
  • adjusted whatsoever parameter mentioned above

I the end: No fun :(.
I switched to client version 2.3., which worked out of the box, see
https://download.nextcloud.com/desktop/releases/Windows/
for older versions. However, I will have to switch over all our installations, too, though :(.

Thanks for the tips, @DooNa1oh! For my instance I just had to add the ‘overwriteprotocol’ to my Nextcloud config.php and things started working right away.

Since my Nextcloud server was behind an Nginx proxy, it didn’t know that the base URL should start with ‘https’. This fixes that:

'overwriteprotocol' => 'https',

Anyone else curious about this configuration option should check this section of the docs.

1 Like

Thanks, this fixed my issue where SSL was being handled by Cloudflare :+1:

For me it was another problem. Maybe it helps someone else too.

I am using php-fpm and I had to add the following line before ProxyPassMatch:

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

I had the same issue. I tried a lot of the other suggestions, but nothing worked except converting back to version 2.3 worked. The only difference is I’m on Mac.

I had the same problem. In my situation it helped to use usernames without spaces.