Forked for project coty-visit. Contains fix for refreshing access token while application is suspended. Problem description in task: https://infullmobile.atlassian.net/browse/LCSD-29
This package provides a limited-scope implementation of MSAuthenticationProvider that can be used to jump-start development with the Microsoft Graph SDK for iOs. Its functionality includes:
- Login via web UI for apps registered on apps.dev.microsoft.com
- Automatic refreshing of access tokens after login
- Logout
It is encouraged to fork or use this implementation as a starting point to develop functionality specific to your needs.
- Install Cocoapods - Follow the getting started guide to install Cocoapods.
- Add the following to your Podfile :
pod 'MSGraphSDK-NXOAuth2Adapter'
- Run the command
pod install
to install the latest version of this pod. - Add
#import <MSGraphSDK-NXOAuth2Adapter/MSGraphSDKNXOAuth2.h>
to all files that need to reference this library.
Register your application on apps.dev.microsoft.com.
- You can set your application's Client ID and required access scopes on the shared NXOAuth2AuthenticationProvider instance. For example, to get read-write access to a user's calendar and OneDrive files:
[NXOAuth2AuthenticationProvider setClientId:<clientId>
scopes:@[@"https://graph.microsoft.com/Files.ReadWrite",
@"https://graph.microsoft.com/Calendars.ReadWrite"]];
- More available scopes can be found here.
- Once you have set the application Id and scopes, you must authenticate the provider and set it on your MSGraphClient instance:
[[NXOAuth2AuthenticationProvider sharedAuthProvider] loginWithViewController:nil completion:^(NSError *error) {
if (!error) {
[MSGraphClient setAuthenticationProvider:[NXOAuth2AuthenticationProvider sharedAuthProvider]];
self.client = [MSGraphClient client];
}
}];
- The MSGraphClient instance is now ready to make requests against the service!
For known issues, see issues.
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.