Skip to content

Allow non-GUID client id with PublicClientApplicationBuilder #4686

@eberlekhaufe

Description

@eberlekhaufe

MSAL client type

Public

Problem statement

MSAL.NET: 4.60.0
.NET 8

I use the PublicClientApplicationBuilder to create a msal app to authenticate with a 3rd party identity provider which issues client ids in the form "Some GUID@somesuffix"

Unfortunately PublicClientApplicationBuilder.Build fails on such a client id, as it expects a proper GUID.

Can that be changed to support non-GUID client ids?
Even if validation was changed, would there be down-stream errors with a non-GUID client id?

Here is my code
var clientBuilder = PublicClientApplicationBuilder.Create("my-non-GUID-clientid")
.WithDefaultRedirectUri()
.WithExperimentalFeatures()
.WithOidcAuthority("some url");

var msalClient = clientBuilder.Build(); // throws here
var result = await msalClient.AcquireTokenInteractive(scopes: ["api", "api:concurrent_access", "email", "oidc", "profile"]).ExecuteAsync();

Calling Build throws a Microsoft.Identity.Client.MsalClientException
Message: Error: ClientId is not a GUID.
Stack Trace:
at Microsoft.Identity.Client.PublicClientApplicationBuilder.Validate()
at Microsoft.Identity.Client.AbstractApplicationBuilder`1.BuildConfiguration()
at Microsoft.Identity.Client.PublicClientApplicationBuilder.BuildConcrete()
at Microsoft.Identity.Client.PublicClientApplicationBuilder.Build()
...

Thanks a lot in advance,
Krischan

Proposed solution

PublicClientApplicationBuilder and PublicClientApplication should support non-GUID client ids, if possible.

Alternatives

Any workaround would also be appreciated, if exists :)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions