Skip to content

Chain the OnMessageReceived event - #2468

Merged
Westin Musser (westin-m) merged 1 commit into
masterfrom
westinm/chainMsgEvent
Sep 18, 2023
Merged

Westin Musser (westin-m) merged 1 commit into
masterfrom
westinm/chainMsgEvent

Conversation

@westin-m

Copy link
Copy Markdown
Contributor

No description provided.

@jennyf19

Copy link
Copy Markdown
Collaborator

Thanks Westin Musser (@westin-m) :shipit:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jennyf19

Copy link
Copy Markdown
Collaborator

tested with:

  services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
                        .AddMicrosoftIdentityWebApi(options =>
                        {
                            options.Events = new JwtBearerEvents
                            {
                                OnMessageReceived = (context) =>
                                {
                                    Console.WriteLine("[OnMessageReceived]");
                                    return Task.CompletedTask;
                                }
                            };
                        }, options =>
                        {
                            options.TenantId = "7f58f645-c190-4ce5-9de4-e2b7acd2a6ab";
                            options.Instance = "https://login.microsoftonline.com/";
                            options.ClientId = "a4c2469b-cf84-4145-8f5f-cb7bacf814bc";
                        }, JwtBearerDefaults.AuthenticationScheme)
                        .EnableTokenAcquisitionToCallDownstreamApi(options => { options.ClientSecret = "secret-of-web-api"; })
#if UseRedisCache
                     //.AddDistributedTokenCaches();
#else
            .AddInMemoryTokenCaches();
            

@westin-m
Westin Musser (westin-m) merged commit fa7b30b into master Sep 18, 2023
@westin-m
Westin Musser (westin-m) deleted the westinm/chainMsgEvent branch September 18, 2023 16:11
This was referenced Aug 15, 2025
This was referenced Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Different behaviour in raising JwtBearerEvents between 2.13.1 and 2.13.2

3 participants