I have been testing Microsoft Graph api user access token by following Java example URL . Yesterday it worked fine but today it always give me com.microsoft.aad.msal4j.MsalClientException: Expired Device code . I dont' give any device code and tried it with created new registered app on Azure Active Directory admin center
Consumer<DeviceCode> deviceCodeConsumer = (DeviceCode deviceCode) -> {
System.out.println(deviceCode.message());
};
// Request a token, passing the requested permission scopes
IAuthenticationResult result = app.acquireToken(
DeviceCodeFlowParameters
.builder(scopeSet, deviceCodeConsumer)
.build()
).exceptionally(ex -> {
System.out.println("Unable to authenticate - " + ex.getMessage());
return null;
}).join();