Add osu! to the list of supported providers#2403
Add osu! to the list of supported providers#2403kevinchalet merged 12 commits intoopeniddict:devfrom
Conversation
* Initial plan * Add osu! OAuth 2.0 provider to OpenIddict WebIntegration Co-authored-by: gehongyan <21241496+gehongyan@users.noreply.github.com> * Fix osu! provider: add client_credentials scope, mode parameter, remove defaults Co-authored-by: gehongyan <21241496+gehongyan@users.noreply.github.com> * Reorder osu! handlers to follow alphabetical order by ProviderTypes Co-authored-by: gehongyan <21241496+gehongyan@users.noreply.github.com> * Fix OSU! ASCII art banner to correctly spell the provider name Co-authored-by: gehongyan <21241496+gehongyan@users.noreply.github.com> * Update osu! banner and add default mode description Co-authored-by: gehongyan <21241496+gehongyan@users.noreply.github.com> * Use mode as path parameter in UserInfo endpoint URL Co-authored-by: gehongyan <21241496+gehongyan@users.noreply.github.com> * Wrap ternary expression in parentheses for C# template string Co-authored-by: gehongyan <21241496+gehongyan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: gehongyan <21241496+gehongyan@users.noreply.github.com>
Docs
Hints
Note Question 1: Is it proper to force setting it in the
Note Question 2: Which naming do you prefer for parameter and constant names: GameMode, Mode, or Ruleset? For the osu!catch constant name, do you prefer Screenshots
|
|
Hey @gehongyan! Thanks for this new PR! 👏🏻
That definitely works, tho' we could also add a new dedicated That said, I see in the docs that the
Re-using the official names is generally the most reasonable approach, but if find the names currently used in your PR are clearer, I don't mind keeping them as-is 😃 Note: you'll probably want to update Thanks! |
src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml
Outdated
Show resolved
Hide resolved
- Extracted OverrideScope handler - Maped WS-Federation properties - Updated XML definitions Signed-off-by: Gehongyan <gehongyan1996@126.com>
|
Hi, thanks for helping.
I’ve tested the behavior when the As shown in the screenshot below, the permission
However, I couldn't find a clean way to remove this scope if the client application specifically doesn't want to request it. Given this, should we still add it by default, or is there a specific method I missed that allows for removing default scopes? Also, it seems that the Client Credentials flow does not automatically pick up the In the meantime, assuming the
I furtherly checked how osu!web and SDKs name it.
Given that most SDKs use the names
The ID is mapped from
|
The idea behind default scopes is that they are not requested if the user explicitly added any other value (they exist because some services require at least one scope to be defined, so default scopes can be considered "fallback values").
Ah yeah, good point. You're right, the scopes configured there are only used for user-interactive flows.
Instead of setting
👍🏻 Thanks! |
Signed-off-by: Gehongyan <gehongyan1996@126.com>
I agree that. But the osu! API documentation states that identify is the default scope for the Authorization Code Grant and always implicitly provided. The Client Credentials Grant does not currently have any default scopes. Furthermore, the scope parameter is optional because when no scope is specified, osu!web only requests identify permissions (Identify you and read your public profile), and the code flow still functions correctly without any explicit scopes. In this case, do we still need to set a default value for Scope in the XML?
Thank you for the tip; However, I suddenly discovered another issue. Some scopes seemed to be only specified in the Client Credentials mode, including |
If the
Scopes registered via // Ask OpenIddict to authenticate the client application using the client credentials grant.
await _service.AuthenticateWithClientCredentialsAsync(new()
{
CancellationToken = stoppingToken,
ProviderName = provider,
Scopes = ["scope1", "scope2"]
}); |
src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs
Outdated
Show resolved
Hide resolved
src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs
Show resolved
Hide resolved
…tly specified Signed-off-by: Gehongyan <gehongyan1996@126.com>
src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml
Outdated
Show resolved
Hide resolved
src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs
Outdated
Show resolved
Hide resolved
Signed-off-by: Gehongyan <gehongyan1996@126.com>
Signed-off-by: Gehongyan <gehongyan1996@126.com>
There was a problem hiding this comment.
Pull request overview
This pull request adds osu! (a popular rhythm game platform) as a supported OAuth authentication provider to the OpenIddict client web integration library.
Key Changes:
- Added osu! provider configuration with OAuth 2.0 endpoints for authorization, token exchange, and user information retrieval
- Implemented custom scope handling for client credentials grant flow (defaults to "public" scope when none specified)
- Added support for optional game mode parameter in userinfo endpoint queries (osu, taiko, fruits, mania)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| OpenIddictClientWebIntegrationProviders.xml | Adds osu! provider definition with OAuth endpoints, game mode constants, and property mappings |
| OpenIddictClientWebIntegrationHandlers.cs | Implements OverrideScope handler for client credentials flow, dynamic userinfo endpoint construction with game mode support, and integrates username/user ID extraction logic |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hey @gehongyan, FYI: OpenIddict just moved from PolySharp to Polyfill, which allows us to use a lot more polyfills thanks to .NET 10's extensions-everything model 😃 To make sure your PR can benefit from that change, I merged the Cheers 😄 |
|
Nice work! 😄 |
|
@gehongyan do you think we can merge your PR or are there changes you'd still like to make depending on ppy/osu-web#12631 outcome? 😃 |
|
@kevinchalet |
|
Merged! Thanks for this great new contribution (and sorry for the late merge 😅) |










This pull request would like to add osu! to the list of supported providers.