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
The MSAL library for iOS gives your app the ability to begin using the [Microsoft identity platform](https://aka.ms/aaddev) by supporting [Microsoft Azure Active Directory](https://azure.microsoft.com/en-us/services/active-directory/) and [Microsoft Accounts](https://account.microsoft.com) in a converged experience using industry standard OAuth2 and OpenID Connect. This sample demonstrates all the normal lifecycles your application should experience, including:
18
+
The MSAL library for iOS gives your app the ability to begin using the [Microsoft identity platform](https://aka.ms/aaddev) by supporting [Microsoft Azure Active Directory](https://azure.microsoft.com/en-us/services/active-directory/) and [Microsoft Accounts](https://account.microsoft.com) in a converged experience using industry standard OAuth2 and OpenID Connect. This sample demonstrates all the normal lifecycle your application should experience, including:
19
19
20
20
- How to get a token
21
21
- How to refresh a token
@@ -35,7 +35,7 @@ To run this sample, you'll need:
35
35
* Xcode
36
36
* An internet connection
37
37
38
-
## Step 1:
38
+
## Step 1:
39
39
40
40
## 1A: Clone or download this repository
41
41
@@ -58,13 +58,9 @@ $ pod install
58
58
$ open MSALiOS.xcworkspace
59
59
```
60
60
61
-
## Step 2: (Optional)
61
+
## Step 2: Register your App (Optional)
62
62
63
-
## 2A: Register your App
64
-
65
-
This app comes pre-configured for testing. If you would like to register your own app, please follow the steps below.
66
-
67
-
To Register an app:
63
+
This app comes pre-configured for testing. If you would like to register your own app, please follow the steps below.
68
64
69
65
1. Sign in to the [Azure portal](https://portal.azure.com) using either a work or school account.
70
66
2. In the left-hand navigation pane, select the **Azure Active Directory** blade, and then select **App registrations**.
@@ -76,10 +72,18 @@ To Register an app:
76
72
5. After the app is created, you'll land on your app management page. Take note of the **Application (client) ID** as this would be needed for the step 2B below.
77
73
6. Click **Authentication**, and add new Redirect URI with type **Public client (mobile & desktop)**. Enter redirect URI in format: `msauth.<app_bundle_id>://auth`. Replace <app_bundle_id> with the **Bundle Identifier** for your application.
78
74
7. Hit the **Save** button in the top left, to save these updates.
75
+
8. Click **Make this change for me** and then download the code sample for iOS
76
+
77
+
## Step 3: Run the sample
78
+
79
+
1. Click the Run Button in the top menu or go to Product from the menu tab and click Run.
80
+
2. Once the sample app launches, click on the 'Call Microsoft Graph API' button to go through the sign in flow and see the results from Microsoft Graph.
79
81
80
-
## 2B: Configure your application
82
+
## How to add MSAL library into your existing Xcode project
81
83
82
-
1. Update your application's redirect URI scheme in the `Info.plist` file by replacing `msauth.com.microsoft.identitysample.MSALiOS` . Redirect URI scheme follows the format `msauth.[app_bundle_id]`. Make sure to substitue [app_bundle_id] with the **Bundle Identifier** for your application.
84
+
## Step 1: Configure your application Info.plist
85
+
86
+
Add URI scheme in the `Info.plist`. Redirect URI scheme follows the format `msauth.[app_bundle_id]`. Make sure to substitute [app_bundle_id] with the **Bundle Identifier** for your application.
83
87
84
88
```xml
85
89
<key>CFBundleURLTypes</key>
@@ -93,52 +97,53 @@ To Register an app:
93
97
</array>
94
98
```
95
99
96
-
2. Configure your application defaults
100
+
## Step 2: Configure your application defaults
97
101
98
-
In the `ViewControler.swift` file, update the `kClientID` variable with your Application (client) ID.
102
+
In your app, add the `kClientID` variable with your Application (client) ID.
99
103
100
104
```swift
101
-
//Update the client ID below with the one you received in the portal. Below ID is for running the sample app only.
102
-
103
-
let kClientID ="66855f8a-60cd-445e-a9bb-8cd8eadbd3fa"
105
+
//For example, you can declare a client id in this way. Below ID is just a sample.
106
+
107
+
let kClientID ="66855f8a-60cd-445e-a9bb-8cd8eadbd3fa"
104
108
```
105
109
106
-
In the `ViewControler.swift` file, update the `kAuthority` variable with your Azure AD and Microsoft Graph endpoints for your national cloud. For global access, use following values:
110
+
Add variables with your Azure AD authority and Microsoft Graph endpoint for your national cloud.
107
111
108
-
```objective-c
112
+
```swift
109
113
let kGraphEndpoint ="https://graph.microsoft.com/"
110
114
let kAuthority ="https://login.microsoftonline.com/common"
111
115
```
112
116
113
117
Other endpoints are documented [here](https://docs.microsoft.com/en-us/graph/deployments#app-registration-and-token-service-root-endpoints). For example, to run the sample with AzureAD Germany, use following:
114
118
115
-
```objective-c
119
+
```swift
116
120
let kGraphEndpoint ="https://graph.microsoft.de/"
117
121
let kAuthority ="https://login.microsoftonline.de/common"
118
122
```
119
123
120
-
## Step 3: Run the sample
124
+
## Step 3: Configure Xcode project settings
121
125
122
-
1. Click the Run Button in the top menu or go to Product from the menu tab and click Run.
123
-
2. Once the sample app launches, click on the 'Call Microsoft Graph API' button to go through the sign in flow and see the results from Microsoft Graph.
126
+
Add a new keychain group to your project **Signing & Capabilities**. The keychain group should be `com.microsoft.adalcache` on iOS.
127
+
128
+

124
129
125
130
## Feedback, Community Help, and Support
126
131
127
-
We use [Stack Overflow](http://stackoverflow.com/questions/tagged/msal) with the community to provide support. We highly recommend you ask your questions on Stack Overflow first and browse existing issues to see if someone has asked your question before.
132
+
We use [Stack Overflow](http://stackoverflow.com/questions/tagged/msal) with the community to provide support. We highly recommend you ask your questions on Stack Overflow first and browse existing issues to see if someone has asked your question before.
128
133
129
-
If you find a bug or have a feature request, please raise the issue on [GitHub Issues](../../issues).
134
+
If you find a bug or have a feature request, please raise the issue on [GitHub Issues](../../issues).
130
135
131
136
To provide a recommendation, visit our [User Voice page](https://feedback.azure.com/forums/169401-azure-active-directory).
132
137
133
138
## Contribute
134
139
135
-
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
140
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
136
141
137
142
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
138
143
139
144
## Security Library
140
145
141
-
This library controls how users sign-in and access services. We recommend you always take the latest version of our library in your app when possible. We use [semantic versioning](http://semver.org) so you can control the risk associated with updating your app. As an example, always downloading the latest minor version number (e.g. x.*y*.x) ensures you get the latest security and feature enhanements but our API surface remains the same. You can always see the latest version and release notes under the Releases tab of GitHub.
146
+
This library controls how users sign-in and access services. We recommend you always take the latest version of our library in your app when possible. We use [semantic versioning](http://semver.org) so you can control the risk associated with updating your app. As an example, always downloading the latest minor version number (e.g. x.*y*.x) ensures you get the latest security and feature enhancements but our API surface remains the same. You can always see the latest version and release notes under the Releases tab of GitHub.
0 commit comments