Microsoft 365 is a suite of Microsoft cloud-based services that include popular applications such as Microsoft Word, Excel, PowerPoint, and Outlook, as well as other services such as OneDrive, SharePoint, and Microsoft Teams. To use Microsoft 365, users must first sign in with their Microsoft account or a Microsoft work or school account. The login process requires users to provide their credentials, including their email or username and password.

To integrate Microsoft 365 login functionality into a Flutter app, you can use the office365_login_flutter library. The library provides an easy-to-use interface for integrating OAuth2 authentication with various providers, including Microsoft 365.

Getting Started

To register your app with the Microsoft Identity Platform, follow these steps:

  1. Go to the Azure Portal and sign in with your Microsoft account. (
  2. create a new flutter project and add the dependency in your pubspec.yaml file
    office365_login_flutter: ^0.0.1

Android Setup

  1. Open the build.gradle file for the app module of your project.
  2. Add the following code to the defaultConfig section in android/app/build.gradle,
    defaultConfig {
         manifestPlaceholders += [appAuthRedirectScheme: "msauth"]
  1. Add the following code to the AndroidManifest.xml file inside the application tag to declare the redirect URI scheme:
           <action android:name="android.intent.action.VIEW" />
           <category android:name="android.intent.category.DEFAULT" />
           <category android:name="android.intent.category.BROWSABLE" />
           <data android:scheme="msauth"
           android:path="/VzSiQcXRmi2kyjzcA+mYLEtbGVs=" />
        android:value="your redirect uri" />

            android:value="your client id" />

IOS Setup

  1. Open the Info.plist file of your project.
  2. Add the following keys to the file:

Please see the example that demonstrates how to sign into the demo IdentityServer instance ( It has also been tested with Azure B2C and Google Sign-in. It is suggested that developers check the documentation of the identity provider they are using to see what capabilities it supports e.g. how to logout, what values of the prompt parameter it supports etc. API docs can be found here

Set up office365_login in your Flutter app

The first step is to create an instance of the plugin

    final AuthorizationTokenResponse? result = await  const Office365Login().authentication(
        discoveryUrl: '',
        scopes: ['openid','profile', 'email',],
        serviceConfiguration: const AuthorizationServiceConfiguration(
          authorizationEndpoint: '',
          tokenEndpoint: '',