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
This quickstart contains a code sample that demonstrates how a native iOS or macOS application can sign in personal, work and school accounts, get an access token, and call the Microsoft Graph API.
27
27
28
-
This quickstart is applicable to both iOS and macOS apps. Some steps are needed only for iOS apps. Those steps call out that they are only for iOS.
28
+
This quickstart applies to both iOS and macOS apps. Some steps are needed only for iOS apps. Those steps call out that they are only for iOS.
29
29
30
30

31
31
@@ -38,10 +38,10 @@ This quickstart is applicable to both iOS and macOS apps. Some steps are needed
38
38
> [!div renderon="docs"]
39
39
> ## Register and download your quickstart app
40
40
> You have two options to start your quickstart application:
41
-
> *[Express][Option 1: Register and auto configure your app and then download your code sample](#option-1-register-and-auto-configure-your-app-and-then-download-your-code-sample)
41
+
> *[Express][Option 1: Register and auto configure your app and then download your code sample](#option-1-register-and-auto-configure-your-app-and-then-download-the-code-sample)
42
42
> *[Manual][Option 2: Register and manually configure your application and code sample](#option-2-register-and-manually-configure-your-application-and-code-sample)
43
43
>
44
-
> ### Option 1: Register and auto configure your app and then download your code sample
44
+
> ### Option 1: Register and auto configure your app and then download the code sample
45
45
> #### Step 1: Register your application
46
46
> To register your app,
47
47
> 1. Go to the new [Azure portal - App registrations](https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/applicationsListBlade/quickStartType/IosQuickstartPage/sourceType/docs) pane.
@@ -58,15 +58,15 @@ This quickstart is applicable to both iOS and macOS apps. Some steps are needed
58
58
> 1. When the **Register an application** page appears, enter your application's registration information:
59
59
> - In the **Name** section, enter a meaningful application name that will be displayed to users of the app when they sign in or consent to your app.
60
60
> - Skip other configurations on this page.
61
-
> -Hit the `Register` button.
61
+
> -Select `Register`.
62
62
> 1. In the **Manage** section, select `Authentication` > `Add Platform` > `iOS`.
63
-
> - Enter the ***Bundle Identifier*** for your application.
63
+
> - Enter the ***Bundle Identifier*** for your application. The bundle identifier is just a unique string that uniquely identifies your application, for example `com.<yourname>.identitysample.MSALMacOS`. Make a note of the value you use.
64
64
> - Note that the iOS configuration is also applicable to macOS applications.
65
-
> 1. Select `Configure` and save the ***MSAL Configuration*** details for later.
65
+
> 1. Select `Configure` and save the ***MSAL Configuration*** details for later in this quickstart.
66
66
> [!div renderon="portal" class="sxs-lookup"]
67
67
>
68
68
> #### Step 1: Configure your application
69
-
> For the code sample for this quickstart to work, you need to add a redirect URI compatible with the Auth broker.
69
+
> For the code sample for this quickstart to work, you need to add a redirect URI compatible with the Auth broker.
@@ -80,7 +80,7 @@ This quickstart is applicable to both iOS and macOS apps. Some steps are needed
80
80
81
81
#### Step 3: Install dependencies
82
82
83
-
In a terminal window, navigate to the folder with the downloaded code sample and run `pod install` to install the latest MSAL library
83
+
In a terminal window, navigate to the folder with the downloaded code sample and run `pod install` to install the latest MSAL library.
84
84
85
85
#### Step 4: Configure your project
86
86
@@ -89,13 +89,13 @@ In a terminal window, navigate to the folder with the downloaded code sample and
89
89
90
90
> [!div renderon="portal" class="sxs-lookup"]
91
91
> 1. Extract the zip file and open the project in XCode.
92
-
> 1. Edit **ViewController.swift** and replace the line starting with 'let kClientID' with the following code snippet:
92
+
> 1. Edit **ViewController.swift** and replace the line starting with 'let kClientID' with the following code snippet. Remember to update the value for `kClientID` with the client ID that you saved when you registered your app in the portal earlier in the quickstart:
>1. Open the project settings. In the **Identity** section, enter the **Bundle Identifier** that you entered into the portal.
97
97
>1. For iOS only, right-click **Info.plist** and select **Open As**>**Source Code**.
98
-
>1. For iOS only, under the dict root node, replace with your***Bundle Id***:
98
+
>1. For iOS only, under the dict root node, replace `Enter_the_bundle_Id_Here`with the***Bundle Id*** that you entered in the portal.
99
99
>
100
100
> ```xml
101
101
><key>CFBundleURLTypes</key>
@@ -107,7 +107,6 @@ In a terminal window, navigate to the folder with the downloaded code sample and
107
107
></array>
108
108
></dict>
109
109
></array>
110
-
>
111
110
> ```
112
111
>1. Build & run the app!
113
112
> [!div class="sxs-lookup" renderon="portal"]
@@ -116,34 +115,33 @@ In a terminal window, navigate to the folder with the downloaded code sample and
116
115
> [!div renderon="docs"]
117
116
>
118
117
>1. Extract the zip file and open the project in XCode.
119
-
>1. Edit **ViewController.swift** and replace the line starting with 'let kClientID' with the following code snippet:
120
-
>
118
+
>1. Edit **ViewController.swift** and replace the line starting with 'let kClientID' with the following code snippet. Remember to update the value for `kClientID` with the clientID that you saved when you registered your app in the portal earlier in this quickstart:
>1. Open the project settings. In the **Identity** section, enter the **Bundle Identifier** that you entered into the portal.
125
123
>1. For iOS only, right-click **Info.plist** and select **Open As**>**Source Code**.
126
-
>1. For iOS only, under the dict root node, replace with your***Bundle Id***:
124
+
>1. For iOS only, under the dict root node, replace `Enter_the_bundle_Id_Here`with the***Bundle Id*** that you used in the portal.
127
125
>
128
126
> ```xml
129
127
><key>CFBundleURLTypes</key>
130
128
><array>
131
129
><dict>
132
130
><key>CFBundleURLSchemes</key>
133
131
><array>
134
-
><string>msauth.<ENTER_YOUR_BUNDLE_ID></string>
132
+
><string>msauth.Enter_the_Bundle_Id_Here</string>
135
133
></array>
136
134
></dict>
137
135
></array>
138
-
>
136
+
>
139
137
> ```
140
138
>1. Build & run the app!
141
139
142
140
## More Information
143
141
144
142
Read these sections to learn more about this quickstart.
145
143
146
-
### Getting MSAL
144
+
### Get MSAL
147
145
148
146
MSAL ([MSAL.framework](https://github.com/AzureAD/microsoft-authentication-library-for-objc)) is the library used to sign in users and request tokens used to access an API protected by Microsoft identity platform. You can add MSAL to your application using the following process:
149
147
@@ -166,7 +164,7 @@ Run CocoaPods installation command:
166
164
167
165
```pod install```
168
166
169
-
### MSAL initialization
167
+
### Initialize MSAL
170
168
171
169
You can add the reference for MSAL by adding the following code:
Your app must also have the following in your `AppDelegate`. This lets MSAL SDK handle token response from the Auth broker app when you perform authentication.
192
+
Your app must also have the following in your `AppDelegate`. This lets MSAL SDK handle token response from the Auth broker app when you do authentication.
@@ -223,7 +220,7 @@ Your app must also have the following in your `AppDelegate`. This lets MSAL SDK
223
220
}
224
221
```
225
222
226
-
Finally, your app must has an `LSApplicationQueriesSchemes` entry in your ***Info.plist*** alongside the `CFBundleURLTypes`. The sample comes with this included.
223
+
Finally, your app must have an `LSApplicationQueriesSchemes` entry in your ***Info.plist*** alongside the `CFBundleURLTypes`. The sample comes with this included.
227
224
228
225
```xml
229
226
<key>LSApplicationQueriesSchemes</key>
@@ -233,16 +230,16 @@ Finally, your app must has an `LSApplicationQueriesSchemes` entry in your ***Inf
233
230
</array>
234
231
```
235
232
236
-
### Sign in users &Request tokens
233
+
### Sign in users &request tokens
237
234
238
235
MSAL has two methods used to acquire tokens: `acquireToken` and `acquireTokenSilent`.
239
236
240
-
#### acquireToken:Getting a token interactively
237
+
#### acquireToken:Get a token interactively
241
238
242
239
Some situations require users to interact with Microsoft identity platform. In these cases, the end user may be required to select their account, enter their credentials, or consent to your app's permissions. For example,
243
240
244
241
* The first time users sign in to the application
245
-
* If a user resets their password, they will need to enter their credentials
242
+
* If a user resets their password, they'll need to enter their credentials
246
243
* When your application is requesting access to a resource for the first time
247
244
* When MFA or other Conditional Access policies are required
>| `scopes` | Contains the scopes being requested (that is, `[ "user.read" ]` for Microsoft Graph or `[ "<Application ID URL>/scope" ]` for custom Web APIs (`api://<Application ID>/access_as_user`) |
257
254
258
-
#### acquireTokenSilent:Getting an access token silently
255
+
#### acquireTokenSilent:Get an access token silently
259
256
260
257
Apps shouldn't require their users to sign in every time they request a token. If the user has already signed in, this method allows apps to request tokens silently.
0 commit comments