-
Notifications
You must be signed in to change notification settings - Fork 219
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] Calling TokenAcquisition.GetAccessTokenForUserAsync throws a NullReferenceException #1440
Comments
@davidkarlsson can you provide a link to your code or a basic repro i can run locally? thank you. |
@jennyf19 I've written a repro you can run locally here now: https://github.com/davidkarlsson/identity-web-token-issue. |
Same issue here. Downgraded Microsoft.Identity.Web 16.1 to 16.0 and all is fine.
Startup.cs:
Unfortunately i'm unable to provide a runnable demo at this moment, but if the provided details are not enough, i could try to spend some time later this week. When same code is used with package 16.0 all is fine. |
@lsiepel can you include a default authentication scheme? Which authentication scheme do you have in your controller, when you call token acquisition? |
Ah sorry, the authentication schemepart was left out. Both schemes are used in the controllers, both lead to the same problem
|
Hi @davidkarlsson, |
Hey @GeorgeTTD! Thanks for the suggestion but as far as I can tell I don't really want the functionality the Also calling |
Will be testing if this issue still persists for the latest version. Is there anything i can do to help fix this issue? |
@jennyf19 Were you able to reproduce this error with 1.16.1 or later with the test repo I created? |
Similar to #1385, this seems to be caused by the options merge not being triggered. I worked around this by getting the |
sorry for the delay in responses. will take a look. |
See PR: #1672 |
Released in 1.24.0. |
After having updated from 1.15.2 to 1.24.1 I now have to pass
Is this a required parameter now or is this a bug? The documentation for the parameter says "Authentication scheme. If null, will use OpenIdConnectDefault.AuthenticationScheme if called from a web app..." so I thought it should work without passing a scheme to it? There's also a spelling mistake there as it should say I'm not sure if this matters but I'm not passing OpenIdConnect as the default authentication scheme when I configure authentication because I'm using both cookie and OpenID Connect authentication:
|
Hi, I lost a lot of time with this problem because the latest version (1.25.0) doesn't work with
|
What does not work @FelipeCostaGualberto
Thanks for the update. |
Hi @jmprieur , as soon as I can create a minimal project I'll provide a repo, thanks for investigating the issue. |
Here is the issue |
Is this fixed? I'm facing the same issue and I am using |
I solved this problem by implementing custom AuthenticationSchemeProvider according to this thread: https://stackoverflow.com/questions/46464469/how-to-configureservices-authentication-based-on-routes-in-asp-net-core-2-0 |
Which version of Microsoft Identity Web are you using?
1.16.1
Where is the issue?
Is this a new or an existing app?
The app is in production and I have upgraded to a new version of Microsoft Identity Web. This error started happening after upgrading from 1.15.2 to 1.16.1. I've verified this by downgrading the package to 1.15.2 again.
I think maybe this issue is related to #1372 but it has already been closed so I opened a new issue for this.
Repro
Expected behavior
I expected
ITokenAcquisition.GetAccessTokenForUserAsync()
to return an access token like it did in 1.15.2 instead of throwing a NullReferenceException.Actual behavior
The call to
ITokenAcquisition.GetAccessTokenForUserAsync()
throws the following exception:The text was updated successfully, but these errors were encountered: