Skip to content

Android: request only the scopes the Desktop OAuth client is granted - #417

Merged
Dvorinka merged 2 commits into
Dvorinka:masterfrom
dxts:fix/android-oauth-scopes
Nov 5, 2026
Merged

Dvorinka merged 2 commits into
Dvorinka:masterfrom
dxts:fix/android-oauth-scopes

Conversation

@dxts

@dxts dxts commented Nov 4, 2026

Copy link
Copy Markdown

"Sign in with browser" fails on every server with Invalid input parameters (Invalid scope requested).

The app authenticates as the built-in Desktop OAuth client (393a1839-f52e-498e-9972-e77cc2241eee), which the server seeds in inventory/migration.go with these scopes:

profile email openid offline_access UserInfo.Write Workflow.Write Files.Write Shares.Write

LoginViewModel.OAUTH_SCOPES additionally requests UserSecurityInfo.Write, which only the iOS client is granted. service/oauth/oauth.go requires the requested scopes to be a subset of the client's registered scopes, so the authorize call is rejected before the user ever sees the consent page.

Dropping that scope restores the browser login. The app does not call any endpoint guarded by UserSecurityInfo.Write (the /user/setting/2fa, authn, email and phone routes), so nothing is lost.

Reproduced against Cloudreve 4.23.7 on an Android 16 emulator: before the change the browser flow stops with the error above; with the change the whole flow completes — authorize, the desktop mount-folder callback, the cloudreve://mount deep link, token exchange, and a logged-in session.

Stacked on #416: this branch includes that one-line compile fix so it builds against the current (broken) master. Once #416 merges, this rebases to a single commit.

Dixit Sabharwal added 2 commits November 4, 2026 21:20
Dvorinka#414 added a second companion object for the 2FA result codes, but the
class already had one holding the OAuth constants. Kotlin allows only one
per class, so compileDebugKotlin failed with "Only one companion object is
allowed per class" and unresolved OAUTH_* references. Move the two constants
into the existing companion object. Verified with ./gradlew :app:assembleDebug
on JDK 21.
"Sign in with browser" failed with "Invalid scope requested": the app uses
the built-in Desktop client, whose seeded scopes do not include
UserSecurityInfo.Write (only the iOS client has it), and the server requires
requested scopes to be a subset of the client's. The app calls no endpoint
guarded by that scope, so drop it.
@mira-tdvorak

mira-tdvorak Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Mira PR Walkthrough


❌ Review failed — click for details

The code review failed to complete due to an unexpected error.

Stage: Code review
Error type: LLMError
Message: LLM tool-call failed

@Dvorinka
Dvorinka merged commit 3b75565 into Dvorinka:master Nov 5, 2026
5 checks passed
@dxts
dxts deleted the fix/android-oauth-scopes branch November 9, 2026 18:27
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.

2 participants