Skip to content

Use Microsoft Graph to access a user’s Microsoft account data from within an iOS app written in Swift. This sample uses REST calls directly to the Microsoft Graph endpoint, and uses the Microsoft Authentication LIbrary (MSAL) for authentication of users' work or school Office 365 accounts.

License

Notifications You must be signed in to change notification settings

Lihan-Chen/ios-swift-connect-rest-sample

 
 

Repository files navigation

page_type products languages extensions
sample
office-365
ms-graph
swift
contentType technologies services platforms createdDate
samples
Microsoft Graph
Azure AD
Microsoft identity platform
Office 365
Microosft identity platform
iOS
1/27/2016 3:56:28 PM

Microsoft Office 365 Connect Sample for iOS Using Microsoft Graph (Swift)

Connecting to Microsoft Office 365 is the first step every iOS app must take to start working with Office 365 services and data. This sample shows how to connect and then call one API through Microsoft Graph.

Note: For the Objective-C version of this sample, see O365-iOS-Microsoft-Graph-Connect.

Prerequisites

Connect sample features

This sample demonstrates several REST calls to the Microsoft Graph REST endpoint.

Register and configure the app

  1. Open a browser and navigate to the Azure Active Directory admin center and login using a personal account (aka: Microsoft Account) or Work or School Account.

  2. Select Azure Active Directory in the left-hand navigation, then select App registrations under Manage.

  3. Select New registration. On the Register an application page, set the values as follows.

    • Set Name to Swift REST Connect Sample.
    • Set Supported account types to Accounts in any organizational directory and personal Microsoft accounts.
    • Under Redirect URI, change the drop down to Public client (mobile & desktop), and set the value to msauth.com.microsoft.O365-iOS-Microsoft-Graph-Connect-Swift-REST://auth.
  4. Choose Register. On the Swift REST Connect Sample page, copy the value of the Application (client) ID and save it, you will need it in the next step.

Update the sample with your client id

  1. Open O365-iOS-Microsoft-Graph-Connect-Swift.xcworkspace

  2. Open AuthenticationConstants.swift and replace <your-client-id> with the application ID you copied in the previous step.

  3. Run the sample.

Contributing

If you'd like to contribute to this sample, see CONTRIBUTING.MD.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Questions and comments

We'd love to get your feedback about the Office 365 iOS Microsoft Graph Connect Swift project. You can send your questions and suggestions to us in the Issues section of this repository.

Questions about Microsoft Graph development in general should be posted to Stack Overflow. Make sure that your questions or comments are tagged with [MicrosoftGraph].

Copyright

Copyright (c) 2017 Microsoft. All rights reserved.

About

Use Microsoft Graph to access a user’s Microsoft account data from within an iOS app written in Swift. This sample uses REST calls directly to the Microsoft Graph endpoint, and uses the Microsoft Authentication LIbrary (MSAL) for authentication of users' work or school Office 365 accounts.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 91.8%
  • HTML 7.2%
  • Other 1.0%