Goal: Use the MS Identity application that was created by Microsoft and try to tailor the application according to our needs.
Issue The android application is not matching the signature hash with the Applications' Reply URI.
Configuration Values
Signature Hash: ga0RGNYHvNM5d0SLGQfpQWAPGJ8=
Redirect URI: msauth://com.azuresamples.msalandroidapp/ga0RGNYHvNM5d0SLGQfpQWAPGJ8%3D
Android:host: com.azuresamples.msalandroidapp
Android Scheme: msauth
Logs and Screenshots
Logs show: The redirect URI in the configuration file doesn't match with the one generated with package name and signature hash. Screenshot of the error in the Android Emulator
Methods Tried
Tried to fix this by changing the android:path value to
/ga0RGNYHvNM5d0SLGQfpQWAPGJ8%3Dhowever got this message from the UI: Screenshot of the update android:path valueTried to change the Reply URI directly from Azure Portal, but was not able to
Tried changing the Redirect URI in the android code to
msauth://com.azuresamples.msalandroidapp/ga0RGNYHvNM5d0SLGQfpQWAPGJ8%3Dbut that gave the same errorThe default library in the code was 1.2, changed it to 1.5+ in gradle and still it didnt work.
Configuration Files
auth_config_single_account.json
"client_id" : "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"authorization_user_agent" : "DEFAULT",
"redirect_uri" : "msauth://com.azuresamples.msalandroidapp/ga0RGNYHvNM5d0SLGQfpQWAPGJ8%3D",
"account_mode" : "SINGLE",
"broker_redirect_uri_registered": true,
"authorities" : [
{
"type": "AAD",
"authority_url": "https://login.microsoftonline.com/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
]
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.azuresamples.msalandroidapp">
...
<intent-filter>
...
<data
android:host="com.azuresamples.msalandroidapp"
android:path="/ga0RGNYHvNM5d0SLGQfpQWAPGJ8="
android:scheme="msauth" />
</intent-filter>
...
</manifest>
Build-Gradle:app
...
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "androidx.appcompat:appcompat:$rootProject.ext.appCompatVersion"
implementation "com.google.android.material:material:$rootProject.ext.materialVersion"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.android.volley:volley:1.1.1'
if (findProject(':msal') != null) {
// For developer team only.
localImplementation project(':msal')
externalImplementation 'com.microsoft.identity.client:msal:1.5.+'
}
else {
// Downloads and Builds MSAL from maven central.
implementation 'com.microsoft.identity.client:msal:1.5.+'
}
}
Update
Was trying to avoid this but I have updated my keystore using the debug.keystore that microsoft provides and it works, however this is not solution for production environments. What are the steps I need to take for this to work in the production environment.