Skip to content

Improve the error message and logs if step1 of FIC fails #3000

Closed
@bgavrilMS

Description

@bgavrilMS

Microsoft.Identity.Web Library

Microsoft.Identity.Web

Microsoft.Identity.Web version

3.1.0

Web app

Sign-in users

Web API

Not Applicable

Token cache serialization

In-memory caches

Description

Web Site calls Graph scenario. Instead of a secret, use a FIC. But configure a bad FIC, e.g. set a invalid id.

Actual: ArgumentException: Delegate to an instance method cannot have null 'this'.
System.MulticastDelegate.ThrowNullThisInDelegateToInstance()
System.MulticastDelegate.CtorClosed(object target, IntPtr methodPtr)
Microsoft.Identity.Web.ConfidentialClientApplicationBuilderExtension.WithClientCredentialsAsync(ConfidentialClientApplicationBuilder builder, IEnumerable clientCredentials, ILogger logger, ICredentialsLoader credentialsLoader, CredentialSourceLoaderParameters credentialSourceLoaderParameters)

Expected: error message and logs should inform the app developer that step1 of FIC failed

Reproduction steps

Web Site calls Graph scenario. Instead of a secret, use a FIC. But configure a bad FIC, e.g. set a invalid id.

Error message

No response

Id Web logs

No response

Relevant code snippets

"AzureAd": {
   "Instance": "https://login.microsoftonline.com/",
   "Domain": "bogavril.onmicrosoft.com",
   "TenantId": "839846c0-9cef-4455-9542-0c36d831d026",
   "ClientId": "089dfe99-af94-4a19-b803-1b01b456b271",
   "ClientCapabilities": [ "cp1" ],
   "CallbackPath": "/signin-oidc"
   
 }


```csharp
 options.ClientCredentials = new List<CredentialDescription>
 {
     new CredentialDescription() {
         SourceType= CredentialSource.SignedAssertionFromManagedIdentity,
         ManagedIdentityClientId = "089dfe99-af94-4a19-b803-1b01b456b271"  } 
   
 };

Regression

no

Expected behavior

Good error message.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions