diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.Configure.cs b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.Configure.cs index 592a73bdb..07acc3bec 100644 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.Configure.cs +++ b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.Configure.cs @@ -20,6 +20,7 @@ using System.Collections.Generic; using System.Linq; using System.Text.Encodings.Web; using System.Text.Unicode; +using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.Auditing; using Volo.Abp.Caching; @@ -315,6 +316,21 @@ public partial class RealtimeMessageHttpApiHostModule options.Authority = configuration["AuthServer:Authority"]; options.RequireHttpsMetadata = false; options.Audience = configuration["AuthServer:ApiName"]; + options.Events = new JwtBearerEvents + { + OnMessageReceived = context => + { + if (context.Token.IsNullOrWhiteSpace()) + { + var accessToken = context.Request.Query["access_token"]; + if (!accessToken.IsNullOrEmpty()) + { + context.Token = accessToken; + } + } + return Task.CompletedTask; + } + }; }); if (!isDevelopment)