Skip to content

Provide more information in error case #328

@ezienecker

Description

@ezienecker

I run a simple example in my application to acquire a token. I get the following error message:

Caused by: com.microsoft.aad.msal4j.MsalClientException: Cached JWT could not be parsed: Invalid JWT serialization: Missing dot delimiter(s)
 	at com.microsoft.aad.msal4j.AuthenticationResult.getTenantProfile(AuthenticationResult.java:54) ~[msal4j-1.8.1.jar!/:1.8.1]
 	at com.microsoft.aad.msal4j.AuthenticationResult.tenantProfile(AuthenticationResult.java:353) ~[msal4j-1.8.1.jar!/:1.8.1]
 	at com.microsoft.aad.msal4j.AuthenticationResult.hashCode(AuthenticationResult.java:283) ~[msal4j-1.8.1.jar!/:1.8.1]

The confusing part, my sample app (just to play around) and the productive ap share the exactly the same code. But in my productive I get the stacktrace. It's really frustrating that there is now meaningful log!

Code sample:

ConfidentialClientApplication app =
					ConfidentialClientApplication.builder(clientId, ClientCredentialFactory.createFromSecret(secret))
							.authority("https://login.microsoftonline.com/tenant")
							.build();

			ClientCredentialParameters clientCredentialParam =
					ClientCredentialParameters.builder(Collections.singleton(SCOPE)).build();

			IAuthenticationResult
					result = app.acquireToken(clientCredentialParam).join();

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAny questions about how MSAL Java works

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions