Skip to content

fix(oauth2): allow users to approve scope changes - #38942

Open
Harsh-128 wants to merge 4 commits into
go-gitea:mainfrom
Harsh-128:oauth2-scope-change
Open

fix(oauth2): allow users to approve scope changes#38942
Harsh-128 wants to merge 4 commits into
go-gitea:mainfrom
Harsh-128:oauth2-scope-change

Conversation

@Harsh-128

Copy link
Copy Markdown

This fixes the OAuth2 flow when an existing grant has a different scope from the requested scope.

Previously, users with an existing grant could get an error when an application requested a different scope. Confidential or trusted applications could also reuse the existing grant without showing the consent page.

This change:

  • updates the existing grant after the user approves a changed scope
  • shows the consent page when a confidential or trusted application requests a different scope
  • adds regression tests for both cases

Tests:

  • go test ./routers/web/auth ./services/oauth2_provider ./models/auth

Fixes #38940.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 15, 2026
@lunny

lunny commented Aug 15, 2026

Copy link
Copy Markdown
Member

It's better to have a hint about the scopes changed in the confirm dialog.

@Harsh-128

Copy link
Copy Markdown
Author

Thanks for the suggestion. I’ll update the confirm dialog to provide a clear hint when the OAuth2 scopes have changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. topic/authentication type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OAuth2: let the user approve a scope change instead of rejecting an existing grant

3 participants