Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Null reference exception when Web API initialized with delegates but without configuration and called from an event handler #1615

Closed
1 task done
jmprieur opened this issue Jan 31, 2022 · 2 comments · Fixed by #1613
Labels
bug Something isn't working P1
Milestone

Comments

@jmprieur
Copy link
Collaborator

Which version of Microsoft Identity Web are you using?
1.22.2

Where is the issue?

  • Web API
    • Protected web APIs call downstream web APIs

Is this a new or an existing app?
New scenario, not met until now (my apps)
Web API initialized with delegates but without configuration and called from an event handler.

Repro

Startup.cs

services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
          .AddMicrosoftIdentityWebApi(options => { Configuration.Bind.("AzureAD", options);}, options => {Configuration.Bind.("AzureAD", options);})
            .EnableTokenAcquisitionToCallDownstreamApi(options => {Configuration.Bind.("AzureAD", options);})
               .AddDownstreamWebApi()
            .AddInMemoryTokenCaches();

and then ITokenAcquisition called from an event handler.

Expected behavior
Should work

Actual behavior
A null reference exception because the configuration is not found

@jmprieur
Copy link
Collaborator Author

jmprieur commented Feb 2, 2022

Will release in 1.22.3

@jmprieur jmprieur reopened this Feb 2, 2022
@jennyf19
Copy link
Collaborator

jennyf19 commented Feb 2, 2022

fixed in 1.22.3 release

@jennyf19 jennyf19 closed this as completed Feb 2, 2022
@jennyf19 jennyf19 modified the milestones: 1.22.2, 1.22.3 Feb 4, 2022
@jennyf19 jennyf19 modified the milestones: 1.24.0, 1.23 Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants