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
In this tutorial, you build an Android app that integrates with the Azure Active Directory (Azure AD) to sign in users and get an access token to call the Microsoft Graph API.
21
21
22
-
When you've completed this tutorial, your application will accept sign-ins of personal Microsoft accounts (including outlook.com, live.com, and others) as well as work or school accounts from any company or organization that uses Azure AD.
22
+
When you've completed this tutorial, your application will accept sign-ins of personal Microsoft accounts (including outlook.com, live.com, and others) and work or school accounts from any company or organization that uses Azure AD.
23
23
24
24
In this tutorial:
25
25
@@ -68,9 +68,9 @@ Follow these steps to create a new project if you don't already have an Android
68
68
1. Select **Register**.
69
69
1. Under **Manage**, select **Authentication** > **Add a platform** > **Android**.
70
70
1. Enter your project's Package Name. If you downloaded the code, this value is `com.azuresamples.msalandroidapp`.
71
-
1. In the **Signature hash** section of the **Configure your Android app** pane, select **Generating a development Signature Hash.** and copy the KeyTool command to your command line..
71
+
1. In the **Signature hash** section of the **Configure your Android app** pane, select **Generating a development Signature Hash.** and copy the KeyTool command to your command line.
72
72
73
-
- KeyTool.exe is installed as part of the Java Development Kit (JDK). You must also install the OpenSSL tool to execute the KeyTool command. Refer to the[Android documentation on generating a key](https://developer.android.com/studio/publish/app-signing#generate-key) for more information.
73
+
- KeyTool.exe is installed as part of the Java Development Kit (JDK). You must also install the OpenSSL tool to execute the KeyTool command. For more information, see[Android documentation on generating a key](https://developer.android.com/studio/publish/app-signing#generate-key) for more information.
74
74
75
75
1. Enter the **Signature hash** generated by KeyTool.
76
76
1. Select **Configure** and save the **MSAL Configuration** that appears in the **Android configuration** pane so you can enter it when you configure your app later.
@@ -79,7 +79,7 @@ Follow these steps to create a new project if you don't already have an Android
79
79
### Configure your application
80
80
81
81
1. In Android Studio's project pane, navigate to **app\src\main\res**.
82
-
1. Right-click **res** and choose **New** > **Directory**. Enter `raw` as the new directory name and click**OK**.
82
+
1. Right-click **res** and choose **New** > **Directory**. Enter `raw` as the new directory name and select**OK**.
83
83
1. In **app** > **src** > **main** > **res** > **raw**, create a new JSON file called `auth_config_single_account.json` and paste the MSAL Configuration that you saved earlier.
84
84
85
85
Below the redirect URI, paste:
@@ -111,7 +111,7 @@ Follow these steps to create a new project if you don't already have an Android
111
111
112
112
As this tutorial only demonstrates how to configure an app in Single Account mode, see [single vs. multiple account mode](./single-multi-account.md) and [configuring your app](./msal-configuration.md) for more information
113
113
114
-
1. In **app** > **src** > **main** > **AndroidManifest.xml**, add the `BrowserTabActivity` activity below to the application body. This entry allows Azure AD to call back to your application after it completes the authentication:
114
+
1. In **app** > **src** > **main** > **AndroidManifest.xml**, add the `BrowserTabActivity` activity after the application body. This entry allows Azure AD to call back to your application after it completes the authentication:
115
115
116
116
```xml
117
117
<!--Intent filter to capture System Browser or Authenticator calling back to our app after sign-in-->
@@ -132,7 +132,7 @@ Follow these steps to create a new project if you don't already have an Android
132
132
- Use your Azure portal **Package name** to replace `android:host=.` value. It should look like `com.azuresamples.msalandroidapp`.
133
133
- Use your Azure portal **Signature Hash** to replace `android:path=` value. Ensure that there's a leading `/` at the beginning of your Signature Hash. It should look like `/1wIqXSqBj7w+h11ZifsnqwgyKrY=`.
134
134
135
-
You'll also be able to find these values in the Authentication blade of your app registration.
135
+
You can find these values in the Authentication blade of your app registration as well.
136
136
137
137
### Add MSAL and relevant libraries to your project
138
138
@@ -257,7 +257,7 @@ Follow these steps to create a new project if you don't already have an Android
257
257
}
258
258
```
259
259
260
-
1. Open _SingleAccountModeFragment_ and replace the code with following code snippet to initializes a single-account application, loads a user account, and gets a token to call the Microsoft Graph API:
260
+
1. Open _SingleAccountModeFragment_ and replace the code with following code snippet to initialize a single-account application, loads a user account, and gets a token to call the Microsoft Graph API:
261
261
262
262
```java
263
263
packagecom.azuresamples.msalandroidapp;
@@ -903,7 +903,7 @@ After you sign in, the app will display the data returned from the Microsoft Gra
903
903
904
904
### Consent
905
905
906
-
The first time any user signs into your app, they'll be prompted by Microsoft identity to consent to the permissions requested. Some Azure AD tenants have disabled user consent which requires admins to consent on behalf of all users. To support this scenario, you'll either need to create your own tenant or receive admin consent.
906
+
The first time any user signs into your app, they'll be prompted by Microsoft identity to consent to the permissions requested. Some Azure AD tenants have disabled user consent, which requires admins to consent on behalf of all users. To support this scenario, you'll either need to create your own tenant or receive admin consent.
Copy file name to clipboardExpand all lines: articles/active-directory/develop/tutorial-v2-shared-device-mode.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,7 +59,7 @@ Refer to the [configuration documentation](./msal-configuration.md) for more inf
59
59
60
60
Set `"shared_device_mode_supported"` to `true` in your MSAL configuration file.
61
61
62
-
You may not be planning to support multiple-account mode. That could be if you're not using a shared device, and the user can sign into the app with more than one account at the same time. If so, set `"account_mode"` to `"SINGLE"`. This guarantees that your app will always get `ISingleAccountPublicClientApplication`, and significantly simplifies your MSAL integration. The default value of `"account_mode"` is `"MULTIPLE"`, so it is important to change this value in the config file if you're using `"single account"` mode.
62
+
You may not be planning to support multiple-account mode. That could be if you're not using a shared device, and the user can sign into the app with more than one account at the same time. If so, set `"account_mode"` to `"SINGLE"`. This guarantees that your app will always get `ISingleAccountPublicClientApplication`, and significantly simplifies your MSAL integration. The default value of `"account_mode"` is `"MULTIPLE"`, so it's important to change this value in the config file if you're using `"single account"` mode.
63
63
64
64
Here's an example of the auth_config.json file included in the **app**>**main**>**res**>**raw** directory of the sample app:
65
65
@@ -85,7 +85,7 @@ Here's an example of the auth_config.json file included in the **app**>**main**>
85
85
86
86
### Detect shared-device mode
87
87
88
-
Shared-device mode allows you to configure Android devices to be shared by multiple employees, while providing Microsoft Identity backed management of the device. Employees can sign in to their devices and access customer information quickly. When they are finished with their shift or task, they will be able to sign-out of all apps on the shared device with a single click and the device will be immediately ready for the next employee to use.
88
+
Shared-device mode allows you to configure Android devices to be shared by multiple employees, while providing Microsoft Identity backed management of the device. Employees can sign in to their devices and access customer information quickly. When they're finished with their shift or task, they'll be able to sign-out of all apps on the shared device with a single click and the device will be immediately ready for the next employee to use.
89
89
90
90
Use `isSharedDevice()` to determine if an app is running on a device that is in shared-device mode. Your app could use this flag to determine if it should modify UX accordingly.
If you're writing an app that will only be used for first-line workers on a shared device, we recommend you write your app to only support single-account mode. This includes most applications that are task focused such as medical records apps, invoice apps, and most line-of-business apps. This will simplify your development as many features of the SDK won't need to be accommodated.
124
124
125
-
If your app supports multiple accounts as well as shared device mode, you must perform a type check and cast to the appropriate interfaceas shown below.
125
+
If your app supports multiple accounts and shared device mode, you must perform a type check and cast to the appropriate interfaceas shown below.
### Receive broadcast to detect global sign out initiated from other applications
209
209
210
-
To receive the account change broadcast, you'll need to register a broadcast receiver. It’s recommended to register your broadcast receiver via the [Context-registered receivers](https://developer.android.com/guide/components/broadcasts#context-registered-receivers).
210
+
To receive the account change broadcast, you need to register a broadcast receiver.It’s recommended to register your broadcast receiver via the [Context-registered receivers](https://developer.android.com/guide/components/broadcasts#context-registered-receivers).
211
211
212
-
When an account change broadcast is received, immediately [get the signed in user and determine if a user has changed on the device](#get-the-signed-in-user-and-determine-if-a-user-has-changed-on-the-device). If a change is detected, initiate data cleanup for previously signed-in account. It is recommended to properly stop any operations and do data cleanup.
212
+
When an account change broadcast is received, immediately [get the signed in user and determine if a user has changed on the device](#get-the-signed-in-user-and-determine-if-a-user-has-changed-on-the-device).If a change is detected, initiate data cleanup for previously signed-in account. It's recommended to properly stop any operations and do data cleanup.
213
213
214
214
The following code snippet shows how you could register a broadcast receiver.
215
215
@@ -245,7 +245,7 @@ For information on how to do this, refer to [Register your application](./tutori
245
245
246
246
:::image type="content" source="media/tutorial-v2-shared-device-mode/register-app.png" alt-text="Configure your Android app page in Azure portal quickstart":::
247
247
248
-
You should select **Makethis change for me** and then provide the values the quickstart asks for in the Azure portal. When that's done, we will generate all the configuration files you need.
248
+
You should select **Makethis change for me** and then provide the values the quickstart asks for in the Azure portal. When that's done, we'll generate all the configuration files you need.
249
249
250
250
:::image type="content" source="media/tutorial-v2-shared-device-mode/config-info.png" alt-text="Configure your project page in Azure portal quickstart":::
251
251
@@ -257,7 +257,7 @@ For testing purposes, set up the following in your tenant: at least two employee
257
257
258
258
### Download the AuthenticatorApp
259
259
260
-
Download the Microsoft Authenticator App from the Google Play store. If you already have the app downloaded, ensure that it is the latest version.
260
+
Download the MicrosoftAuthenticatorApp from the GooglePlay store. If you already have the app downloaded, ensure that it's the latest version.
261
261
262
262
### Authenticator app settings & registering the device in the cloud
263
263
@@ -293,7 +293,7 @@ Once you've put a device in shared-mode, it becomes known to your organization a
293
293
294
294
## Running the sample app
295
295
296
-
The Sample Application is a simple app that will call the Graph API of your organization. On first run you'll be prompted to consent as the application is new to your employee account.
296
+
The Sample Application is a simple app that will call the Graph API of your organization. On first run, you'll be prompted to consent as the application is new to your employee account.
297
297
298
298
:::image type="content" source="media/tutorial-v2-shared-device-mode/run-app-permissions-requested.png" alt-text="Application configuration info screen":::
0 commit comments