You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which version of Microsoft Identity Web are you using?
Note that to get help, you need to run the latest version.
Microsoft Identity Web 1.23.0
Where is the issue?
Web app
Sign-in users
Sign-in users and call web APIs
Web API
Protected web APIs (validating tokens)
Protected web APIs (validating scopes)
Protected web APIs call downstream web APIs
Token cache serialization
In-memory caches
Session caches
Distributed caches
Other (please describe)
Is this a new or an existing app?
c. This is a new app or an experiment.
Repro
We are trying to get an App-only token for MSGraph in C# background task by uisng services.AddHostedService<>();
The code we use to get token: await _tokenAcquisition.GetAuthenticationResultForAppAsync($"{ResourceId}/.default", tenant: tenantId, null);
Then we received a null Ref error from IdWeb library
Expected behavior
The background task should be able to get an app-only token
Actual behavior
An exception was thrown by IdWeb.
Possible solution
Additional context / logs / screenshots / link to code
Exception details:
at Microsoft.Identity.Web.MergedOptions.PrepareAuthorityInstanceForMsal()
at Microsoft.Identity.Web.TokenAcquisition.BuildConfidentialClientApplication(MergedOptions mergedOptions)
at Microsoft.Identity.Web.TokenAcquisition.GetOrBuildConfidentialClientApplication(MergedOptions mergedOptions)
at Microsoft.Identity.Web.TokenAcquisition.GetAuthenticationResultForAppAsync(String scope, String authenticationScheme, String tenant, TokenAcquisitionOptions tokenAcquisitionOptions)
at Microsoft.Identity.Web.TokenAcquisition.d__19.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Clients.BaseAuthenticationHandler.d__16.MoveNext() in D:\Code\AD-IAM-Services-MyApps\src\Clients\BaseAuthenticationHandler.cs:line 167
The text was updated successfully, but these errors were encountered:
xubinzheng
changed the title
[Bug]
[Bug] Object Null Reference in GetAuthenticationResultForAppAsync - background task
Mar 11, 2022
Which version of Microsoft Identity Web are you using?
Note that to get help, you need to run the latest version.
Microsoft Identity Web 1.23.0
Where is the issue?
Is this a new or an existing app?
c. This is a new app or an experiment.
Repro
We are trying to get an App-only token for MSGraph in C# background task by uisng services.AddHostedService<>();
The code we use to get token:
await _tokenAcquisition.GetAuthenticationResultForAppAsync($"{ResourceId}/.default", tenant: tenantId, null);
Then we received a null Ref error from IdWeb library
Expected behavior
The background task should be able to get an app-only token
Actual behavior
An exception was thrown by IdWeb.
Possible solution
Additional context / logs / screenshots / link to code
Exception details:
at Microsoft.Identity.Web.MergedOptions.PrepareAuthorityInstanceForMsal()
at Microsoft.Identity.Web.TokenAcquisition.BuildConfidentialClientApplication(MergedOptions mergedOptions)
at Microsoft.Identity.Web.TokenAcquisition.GetOrBuildConfidentialClientApplication(MergedOptions mergedOptions)
at Microsoft.Identity.Web.TokenAcquisition.GetAuthenticationResultForAppAsync(String scope, String authenticationScheme, String tenant, TokenAcquisitionOptions tokenAcquisitionOptions)
at Microsoft.Identity.Web.TokenAcquisition.d__19.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Clients.BaseAuthenticationHandler.d__16.MoveNext() in D:\Code\AD-IAM-Services-MyApps\src\Clients\BaseAuthenticationHandler.cs:line 167
The text was updated successfully, but these errors were encountered: