Skip to content

feat(auth): add the account user to the login URL when it signs in again - #18082

Open
filerun wants to merge 1 commit into
nextcloud:masterfrom
filerun:feat/login-flow-account-user
Open

filerun wants to merge 1 commit into
nextcloud:masterfrom
filerun:feat/login-flow-account-user

Conversation

@filerun

@filerun filerun commented Nov 19, 2026

Copy link
Copy Markdown

Problem

When an existing account signs in again, the app opens the login URL of login flow v2 without the user of the account. In the same case, the desktop client adds the user to the login URL, as the user parameter.

A server can use this parameter in these ways:

  • Nextcloud pre-fills its login form with the user.
  • A server can refuse the grant when another account is signed in in the browser.
  • A server can hand out the login name that the account was created with.

The last point matters because of commit 1c3451b. That commit made the app compare the user ID of the new credentials with the user ID of the account. Some servers gave an account another login name in the past. Without the parameter, such a server cannot know which login name the account holds. The server then hands out the current name, and the app refuses the new credentials after the person granted access.

Change

  • AuthenticatorUrlUtils.appendLoginUser() appends the user, URL-encoded, as the user parameter.
  • When AuthenticatorActivity signs an existing account in again, it appends the user name of the account to the login URL that the server returns. The login URL of a new account, and the default login URL, stay unchanged.

How to verify

  1. Add an account.
  2. Revoke the app password of the account on the server. The app then asks to sign in again.
  3. Sign in again from the notification of the app.
  4. Expected: the login URL that opens in the browser ends with user= and the user name of the account. On Nextcloud, the login form shows the user name already filled in.

The unit tests in AuthenticatorUrlUtilsTest.AppendLoginUser cover a login URL with a query, a login URL without a query, and the encoding of the user.

🖼️ Screenshots

No screenshots. The change was not run on a device.

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed. The unit tests are included, but they were not run: the change was not built, and spotless, detekt and lint were not run.
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI (Claude Code, claude-opus-5-5)

🤖 Generated with Claude Code

When an existing account signs in again, the app opens the login URL of
login flow v2 without the user of the account. In the same case, the desktop
client adds the user to the login URL, as the "user" parameter.

A server can use this parameter in these ways:

- Nextcloud pre-fills its login form with the user.
- A server can refuse the grant when another account is signed in in the
  browser.
- A server can hand out the login name that the account was created with.

The last point matters because of commit 1c3451b. That commit made the app
compare the user ID of the new credentials with the user ID of the account.
Some servers gave an account another login name in the past. Without the
parameter, such a server cannot know which login name the account holds. The
server then hands out the current name, and the app refuses the new
credentials after the person granted access.

The app now appends the user name of the account to the login URL that the
server returns, when it signs an existing account in again. The login URL of
a new account, and the default login URL, stay unchanged.

Assisted-by: ClaudeCode:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant