0

I have to integrate Microsoft authentication API for login in the android app. for that I registered my app to the Azure portal, by providing a package name and Signature hash. Signature hash is generated using this command keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%.android\debug.keystore | openssl sha1 -binary | openssl base64

on app run, I'm getting this exception MsalClient Exception: The redirect URI does not match with the package name and signature hash. but both the package name and signature hash is the same at android and Azure. im following this tutorial https://learn.microsoft.com/en-us/azure/active-directory/develop/tutorial-v2-android

1 Answers1

0

I test the sample code and it works fine.

Make sure that you need to follow this part to configure your Azure AD app.

There are two files need to be configured: AndroidManifest.xml and auth_config.json.

My configuration for your reference:

auth_config_multiple_account.json

{
  "client_id" : "6cXXXXa2-295d-455a-88fe-b1XXXXXXXX0e",
  "authorization_user_agent" : "DEFAULT",
  "redirect_uri" : "msauth://com.azuresamples.msalandroidapp/1wIqXSqBj7w%2Bh11ZifsnqwgyKrY%3D",
  "authorities" : [
    {
      "type": "AAD",
      "audience": {
        "type": "AzureADandPersonalMicrosoftAccount",
        "tenant_id": "common"
      }
    }
  ]
}

AndroidManifest.xml

<data
                    android:host="com.azuresamples.msalandroidapp"
                    android:path="/1wIqXSqBj7w+h11ZifsnqwgyKrY="
                    android:scheme="msauth" />

Azure AD app

enter image description here

Allen Wu
  • 15,529
  • 1
  • 9
  • 20
  • @iSevaDigital You need to specify the path. My example for your reference: `keytool -exportcert -alias androiddebugkey -keystore "E:\Programs\ms-identity-android-java-master\gradle\debug.keystore" | "C:\OpenSSL\bin\openssl" sha1 -binary | "C:\OpenSSL\bin\openssl" base64` – Allen Wu Sep 03 '20 at 09:48
  • @iSevaDigital You can also refer to https://stackoverflow.com/questions/7506392/how-to-create-android-facebook-key-hash. – Allen Wu Sep 03 '20 at 09:51