Describe the bug
When using Azure Communication Services Chat SDK alongside Microsoft Authentication Library (MSAL) in the same Android app, the ACS Push Notification worker crashes during key rotation because it incorrectly parses all AndroidKeyStore aliases, including MSAL's "AdalKey".
ACS assumes that all KeyStore aliases follow its own _ pattern and tries to extract a numeric suffix. MSAL’s alias "AdalKey" is not numeric, which leads to:
java.lang.NumberFormatException: For input string: "AdalKey"
This makes ACS push notifications incompatible with MSAL authentication in the same app.
This appears to be an architectural bug in ACS Chat SDK.
Exception or Stack Trace
java.lang.NumberFormatException: For input string: "AdalKey"
java.lang.NumberFormatException: For input string: "AdalKey"
at java.lang.Integer.parseInt(Integer.java:615)
at java.lang.Integer.parseInt(Integer.java:650)
at com.azure.android.communication.chat.implementation.notifications.fcm.RegistrationKeyManager.extractIndex(RegistrationKeyManager.java:158)
at com.azure.android.communication.chat.implementation.notifications.fcm.RegistrationKeyManager.rotateKeys(RegistrationKeyManager.java:170)
at com.azure.android.communication.chat.implementation.notifications.fcm.RegistrationRenewalWorker.doWork(RegistrationRenewalWorker.java:93)
To Reproduce
Create an Android app
Add dependencies:
implementation("com.azure.android:azure-communication-chat:2.1.0")
implementation("com.microsoft.identity.client:msal:5.x")
Initialize MSAL (which creates "AdalKey" alias)
Initialize ACS Chat with push notifications
Wait for ACS background worker (RegistrationRenewalWorker) to execute key rotation
Observe crash
Code Snippet
try {
Enumeration aliases = keyStore.aliases();
while (aliases.hasMoreElements()) {
set.add(extractIndex(aliases.nextElement()));
}
} catch (KeyStoreException e) {
throw clientLogger.logExceptionAsError(new RuntimeException("Failed iterate key-store", e));
}
Expected behavior
We should expect the key to be either ignored or properly handled so that we can use both the MSAL and ACS library and to have push notifications WorkManager setup for Android devices
Screenshots
Screenshots show:
Debugger showing aliases = keyStore.aliases() returning "AdalKey" alongside ACS-generated aliases.
extractIndex() attempting to run Integer.parseInt("AdalKey").
The WorkManager task (RegistrationRenewalWorker) failing and retrying indefinitely.
Setup (please complete the following information):
- OS: [e.g. iOS] - Android 15, 13, 12
- IDE : [e.g. IntelliJ] - Android Studio Otter 2 Feature Drop
- com.azure.android:azure-communication-chat:2.2.0
- com.microsoft.identity.client:msal:8.1.1
Please fix this bug or provide a workaround in the SDK so ACS Chat Push Notifications can work alongside MSAL authentication.
Describe the bug
When using Azure Communication Services Chat SDK alongside Microsoft Authentication Library (MSAL) in the same Android app, the ACS Push Notification worker crashes during key rotation because it incorrectly parses all AndroidKeyStore aliases, including MSAL's "AdalKey".
ACS assumes that all KeyStore aliases follow its own _ pattern and tries to extract a numeric suffix. MSAL’s alias "AdalKey" is not numeric, which leads to:
java.lang.NumberFormatException: For input string: "AdalKey"This makes ACS push notifications incompatible with MSAL authentication in the same app.
This appears to be an architectural bug in ACS Chat SDK.
Exception or Stack Trace
java.lang.NumberFormatException: For input string: "AdalKey"
To Reproduce
Create an Android app
Add dependencies:
implementation("com.azure.android:azure-communication-chat:2.1.0")
implementation("com.microsoft.identity.client:msal:5.x")
Initialize MSAL (which creates "AdalKey" alias)
Initialize ACS Chat with push notifications
Wait for ACS background worker (RegistrationRenewalWorker) to execute key rotation
Observe crash
Code Snippet
try {
Enumeration aliases = keyStore.aliases();
while (aliases.hasMoreElements()) {
set.add(extractIndex(aliases.nextElement()));
}
} catch (KeyStoreException e) {
throw clientLogger.logExceptionAsError(new RuntimeException("Failed iterate key-store", e));
}
Expected behavior
We should expect the key to be either ignored or properly handled so that we can use both the MSAL and ACS library and to have push notifications WorkManager setup for Android devices
Screenshots
Screenshots show:
Debugger showing aliases = keyStore.aliases() returning "AdalKey" alongside ACS-generated aliases.
extractIndex() attempting to run Integer.parseInt("AdalKey").
The WorkManager task (RegistrationRenewalWorker) failing and retrying indefinitely.
Setup (please complete the following information):
Please fix this bug or provide a workaround in the SDK so ACS Chat Push Notifications can work alongside MSAL authentication.