Code Monkey home page Code Monkey logo

msgraph-sdk-ios-nxoauth2-adapter's Introduction

Microsoft Graph iOs SDK Authentication Quick-Start Kit

Overview

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.

1. Installation

Install via Cocoapods

  • 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.

2. Getting started

2.1 Register your application

Register your application on apps.dev.microsoft.com.

2.2 Setting your application Id and scopes

  • 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.

2.3 Getting an authenticated MSGraphClient object

  • 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!

4. Issues

For known issues, see issues.

5. License

License

msgraph-sdk-ios-nxoauth2-adapter's People

Contributors

kevklam avatar tobihagemann avatar unpluggedk avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.