RT would not work for me without this

This commit is contained in:
Veljko Tosic
2026-02-18 20:22:58 +01:00
parent 21d5322024
commit 7bae0d4dd6

View File

@@ -64,6 +64,23 @@ public static class UserContextRegistrationExtension
IssuerSigningKey = new SymmetricSecurityKey( IssuerSigningKey = new SymmetricSecurityKey(
Encoding.UTF8.GetBytes(jwtSettings.Key)) Encoding.UTF8.GetBytes(jwtSettings.Key))
}; };
options.Events = new JwtBearerEvents
{
OnMessageReceived = context =>
{
var accessToken = context.Request.Query["access_token"];
var path = context.HttpContext.Request.Path;
if (!string.IsNullOrEmpty(accessToken) &&
path.StartsWithSegments("/hubs"))
{
context.Token = accessToken;
}
return Task.CompletedTask;
}
};
}); });
services.AddAuthorization(); services.AddAuthorization();