diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs index c5265080..43dbffd6 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs @@ -635,7 +635,7 @@ public static partial class OpenIddictClientWebIntegrationHandlers = OpenIddictClientHandlerDescriptor.CreateBuilder() .AddFilter() .UseSingletonHandler() - .SetOrder(AttachTokenRequestParameters.Descriptor.Order + 250) + .SetOrder(AttachTokenRequestParameters.Descriptor.Order - 500) .SetType(OpenIddictClientHandlerType.BuiltIn) .Build(); @@ -647,14 +647,13 @@ public static partial class OpenIddictClientWebIntegrationHandlers throw new ArgumentNullException(nameof(context)); } - Debug.Assert(context.TokenRequest is not null, SR.GetResourceString(SR.ID4008)); - // osu! requires that the scope must be "public" for client credentials // grant, as other scopes have no meaningful effect. if (context.GrantType is GrantTypes.ClientCredentials && context.Registration.ProviderType is ProviderTypes.Osu) { - context.TokenRequest.Scope = "public"; + context.Scopes.Add("public"); + // TODO: how does user code add custom scopes here? } return ValueTask.CompletedTask; @@ -963,7 +962,7 @@ public static partial class OpenIddictClientWebIntegrationHandlers // Note: these providers don't have a static userinfo endpoint attached to their configuration // so OpenIddict doesn't, by default, send a userinfo request. Since a dynamic endpoint is later // computed and attached to the context, the default value MUST be overridden to send a request. - ProviderTypes.Dailymotion or ProviderTypes.HubSpot or + ProviderTypes.Dailymotion or ProviderTypes.HubSpot or ProviderTypes.Osu or ProviderTypes.SuperOffice or ProviderTypes.Zoho when context.GrantType is GrantTypes.AuthorizationCode or GrantTypes.DeviceCode or GrantTypes.Implicit or GrantTypes.Password or @@ -1099,6 +1098,13 @@ public static partial class OpenIddictClientWebIntegrationHandlers left : new Uri("https://api.hubapi.com/oauth/v1/access-tokens", UriKind.Absolute), right: new Uri(token, UriKind.Relative)), + // osu! supports specifying a game mode when querying the userinfo endpoint. + ProviderTypes.Osu + => !context.Properties.TryGetValue(Osu.Properties.GameMode, out string? gameMode) || + string.IsNullOrEmpty(gameMode) ? + new Uri("https://osu.ppy.sh/api/v2/me", UriKind.Absolute) : + new Uri($"https://osu.ppy.sh/api/v2/me/{gameMode}", UriKind.Absolute), + // SuperOffice doesn't expose a static OpenID Connect userinfo endpoint but offers an API whose // absolute URI needs to be computed based on a special claim returned in the identity token. ProviderTypes.SuperOffice when diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml index c3fe7c59..a1cf813d 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml @@ -1759,8 +1759,7 @@ Documentation="https://osu.ppy.sh/docs/index.html#authentication"> + TokenEndpoint="https://osu.ppy.sh/oauth/token"> @@ -1773,8 +1772,7 @@ - +