1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-22 23:00:52 +08:00

Replace manual specification of Authorization header with SignalR-provided provider property

The property used here is listed in SignalR documentation:

	https://learn.microsoft.com/en-us/aspnet/core/signalr/authn-and-authz?view=aspnetcore-10.0#bearer-token-authentication

While in practice this probably has zero bearing on anything,
theoretically the way proposed in this commit is more correct.
As the documentation states, with some transports the token may need to
be renewed if it expires, which providing it via a header as done
previously would not achieve, while going through `API.AccessToken`
every time will perform a token refresh if one is needed.
This commit is contained in:
Bartłomiej Dach
2026-01-13 10:55:51 +01:00
Unverified
parent f9e70f06b3
commit d5aa5b61ad
+1 -1
View File
@@ -65,7 +65,7 @@ namespace osu.Game.Online
options.Proxy.Credentials = CredentialCache.DefaultCredentials;
}
options.Headers.Add(@"Authorization", @$"Bearer {API.AccessToken}");
options.AccessTokenProvider = () => Task.FromResult<string?>(API.AccessToken);
// non-standard header name kept for backwards compatibility, can be removed after server side has migrated to `VERSION_HASH_HEADER`
options.Headers.Add(@"OsuVersionHash", versionHash);
options.Headers.Add(VERSION_HASH_HEADER, versionHash);