You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: support/entra/entra-id/app-integration/android-app-authentication-fails-after-published-to-google-play-store.md
+26-28Lines changed: 26 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,65 +1,63 @@
1
1
---
2
-
title: Android app authentication fails after published to Google Play Store
3
-
description: Provides a solution to an authentication failure with an Android app that's published to Google Play Store.
2
+
title: Android App Authentication Fails After Being Published to Google Play Store
3
+
description: Provides a solution to an authentication failure with an Android app that's published to the Google Play Store.
4
4
ms.reviewer: markbukovich, v-weizhu
5
5
ms.service: entra-id
6
6
ms.date: 02/19/2025
7
7
ms.custom: sap:Developing or Registering apps with Microsoft identity platform
8
8
---
9
-
# Authentication failed after Android app is published to Google Play Store
9
+
# Authentication fails after an Android app is published to the Google Play Store
10
10
11
-
This article provides a solution to an authentication failure that occurs during signing in after users install an Android app that's published to Google Play Store.
11
+
This article provides a solution to an authentication failure that occurs during signing in after users install an Android app that's published to the Google Play Store.
12
12
13
13
## Symptoms
14
14
15
15
Consider the following scenario:
16
16
17
-
- You have successfully implemented Microsoft Entra Authentication in your Android app with the Microsoft Authentication Library.
18
-
- The app has been built and executed, and passed all QA testing.
19
-
- You publish the app to Google Play Store.
17
+
- You have successfully implemented Microsoft Entra authentication in your Android app with the Microsoft Authentication Library (MSAL).
18
+
- The app has been built and executed and has passed all QA testing.
19
+
- You publish the app to the Google Play Store.
20
20
21
21
After users install the app, authentication doesn't work when signing in to the app.
22
22
23
-
If you expose authentication error messages to users or if you let them send error messages to your team, you may encounter an error message like the following text:
23
+
If you expose authentication error messages to users, or if you let them send error messages to your team, you may encounter an error message like the following text:
24
24
25
25
> The redirect URI in the configuration file doesn't match with the one generated with the package name and signature hash. Please verify the uri in the config file and your app registration in Azure portal.
26
26
27
-
Another possible scenario of this issue is:
27
+
Another possible scenario for this issue is:
28
28
29
-
During development and QA testing, you set up your app to use a supported broker to handle authentication and SSO.
30
-
31
-
However, after the app deployment through Google Play and installation, the app no longer uses the broker for authentication.
29
+
During development and QA testing, you set up your app to use a supported broker to handle authentication and single sign-on (SSO). However, after the app is deployed through Google Play and installed, the app no longer uses the broker for authentication.
32
30
33
31
## Cause
34
32
35
-
When an Android application is built for installation on a device, it is built as an APK compressed package and then signed by a certificate. This certificate signing ensures that the person who built the application is the one who owns the private signing key. This prevents hackers from modifying the application harmfully, as they can't sign their version with the original private key.
33
+
When an Android application is built for installation on a device, it's built as an APK compressed package and then signed by a certificate. This certificate signing ensures that the person who built the application is the one who owns the private signing key. This prevents hackers from making harmful modifications to the application, as they can't sign their versions with the original private key.
36
34
37
-
Previously, Android developers owned and maintained their private signing keys. Currently, Google Play Services generate and maintain the private signing key for Android developers, ensuring secure storage by Google. The developer still maintains an upload key so that Google Play Services can verify the authenticity of an uploaded app bundle, but the actual signing is performed by the Google-owned signing certificate when users install the app on their device.
35
+
Previously, Android developers owned and maintained their private signing keys. Currently, Google Play Services generates and maintains the private signing key for Android developers, ensuring secure storage by Google. The developer still maintains an upload key so that Google Play Services can verify the authenticity of an uploaded app bundle, but the actual signing is performed by the Google-owned signing certificate when users install the app on their devices.
38
36
39
-
The Microsoft Authentication Library (MSAL) for Android Native and Microsoft Supported Authentication Brokers use the public signature hash of an installed application to identify it when interacting through the Android Operating system during authentication.
37
+
The MSAL for Android Native and Microsoft Supported Authentication Brokers use the public signature hash of an installed application to identify it when interacting with the Android operating system during authentication.
40
38
41
-
The public signature hash of an application installed via Google Play differs from one installed before publishing to Google Play. Thus, MSAL will be configured with the incorrect signature hash.
39
+
The public signature hash of an application installed via Google Play differs from the one installed before publishing to Google Play. Thus, MSAL will be configured with the incorrect signature hash.
42
40
43
41
## Solution
44
42
45
43
To resolve this issue, do the following things:
46
44
47
-
-[Get the new signature hash with the MSAL Package Inspector tool or from the Google Play Console](#get-the-new-signature-hash-with-the-msal-package-inspector-tool-or-from-the-google-play-console).
45
+
-[Get a new signature hash with the MSAL Package Inspector tool or from the Google Play Console](#get-a-new-signature-hash-with-the-msal-package-inspector-tool-or-from-the-google-play-console).
48
46
-[Add a new redirect URI to the app registration in the Azure portal with the new signature hash](#add-a-new-redirect-uri-to-the-app-registration-in-the-azure-portal-with-the-new-signature-hash).
49
47
-[Update the MSAL configuration within the application code to use the new redirect URI and signature hash](#update-the-msal-configuration-within-the-application-code-to-use-the-new-redirect-uri-and-signature-hash).
50
48
51
-
### Get the new signature hash with the MSAL Package Inspector tool or from the Google Play Console
49
+
### Get a new signature hash with the MSAL Package Inspector tool or from the Google Play Console
52
50
53
-
You can get the new signature hash by using the MSAL Package Inspector tool or from the Google Play Console.
51
+
You can get a new signature hash by using the MSAL Package Inspector tool or from the Google Play Console.
54
52
55
53
To install and use the MSAL Package Inspector, see [Package Inspector for MSAL Android Native Guide](https://blogs.aaddevsup.xyz/2022/03/package-inspector-for-msal-android-native-guide/).
56
54
57
55
To get the signature hash from the Google Play Console, follow these steps:
58
56
59
57
1. Go to the Google Play Console and sign in with your Google Developer account.
60
-
2. Once you are in the Google Play Console, select the affected app.
58
+
2. Once you're in the Google Play Console, select the affected app.
61
59
3. On the left navigation, under the **Release** category, expand **Setup** and select **App Integrity**.
62
-
4. Select the **App signing** tab. You will see the fingerprint of the app signing key in three different variations.
60
+
4. Select the **App signing** tab. You'll see the fingerprint of the app signing key in three different variations.
63
61
5. Copy the **SHA-1 certificate fingerprint** and paste it into the PowerShell script in step 6 as the value of the `$Thumbprint` variable.
64
62
6. Run the following script to obtain the base64 encoded fingerprint that MSAL needs:
65
63
@@ -78,26 +76,26 @@ To get the signature hash from the Google Play Console, follow these steps:
78
76
Write-Host $hashedString
79
77
```
80
78
81
-
:::image type="content" source="media/android-app-authentication-fails-after-published-to-google-play-store/google-play-console-app-signing.png" alt-text="Screenshot that shows how to get the signature hash from Google Play Console.":::
79
+
:::image type="content" source="media/android-app-authentication-fails-after-published-to-google-play-store/google-play-console-app-signing.png" alt-text="Screenshot that shows how to get the signature hash from the Google Play Console." lightbox="media/android-app-authentication-fails-after-published-to-google-play-store/google-play-console-app-signing.png":::
82
80
83
81
### Add a new redirect URI to the app registration in the Azure portal with the new signature hash
84
82
85
83
> [!NOTE]
86
-
> We recommend adding a new redirect URI rather than modifying the existing one. Your app registration can contain many redirect URIs. Additionally, modifying the existing redirect URI might result in problems with the development version of your app. This could cause issues during troubleshooting, developing updates, and so on.
84
+
> We recommend adding a new redirect URI rather than modifying the existing one. Your app registration can contain many redirect URIs. Additionally, modifying the existing redirect URI might result in problems with the development version of your app. This can cause issues during troubleshooting, development updates, and so on.
87
85
88
86
1. Sign in to the Azure portal and navigate to the **App registrations** page.
89
87
2. Select the app registration for your Android app.
90
88
3. Under **Manage**, select **Authentication**.
91
89
4. Under **Platform configurations**, select **Add a platform**.
92
90
5. Under **Configure platforms**, select **Android**.
93
91
94
-
:::image type="content" source="media/android-app-authentication-fails-after-published-to-google-play-store/app-reg-platform-config.png" alt-text="Screenshot that shows how to configure Android platform.":::
95
-
6. Enter the package name of your Android app. Also generate and enter the signature hash.
92
+
:::image type="content" source="media/android-app-authentication-fails-after-published-to-google-play-store/app-reg-platform-config.png" alt-text="Screenshot that shows how to configure the Android platform.":::
93
+
6. Enter the package name of your Android app. Also, generate and enter the signature hash.
96
94
97
95
:::image type="content" source="media/android-app-authentication-fails-after-published-to-google-play-store/app-registrations-configure-android-app.png" alt-text="Screenshot that shows how to configure an Android app.":::
98
96
99
97
> [!NOTE]
100
-
> It's fine to use the same package name in multiple Android Redirect URIs as long as the signature hash is different.
98
+
> It's fine to use the same package name in multiple Android redirect URIs as long as the signature hash is different.
101
99
7. Select **Configure** to complete the platform configuration.
102
100
103
101
### Update the MSAL configuration within the application code to use the new redirect URI and signature hash
@@ -132,7 +130,7 @@ Update the MSAL configuration file and Android Manifest file in the application
132
130
133
131
- Android Manifest file:
134
132
135
-
Only change the `android:path` property in the `com.microsoft.identity.client.BrowserTabActivity` activity. Paste the signature hash as the value for this property.
133
+
Only change the `android:path` property in the `com.microsoft.identity.client.BrowserTabActivity` activity. Paste the signature hash as the value of this property.
136
134
137
135
```xml
138
136
<activity
@@ -151,7 +149,7 @@ Update the MSAL configuration file and Android Manifest file in the application
151
149
152
150
153
151
> [!NOTE]
154
-
> - Make sure to include the forward slash at the front of the signature hash.
152
+
> - Make sure to include the forward slash in front of the signature hash.
155
153
> - Unlike the redirect URI, the signature hash here isn't HTTP encoded.
0 commit comments