Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Provides one or more widgets to handle OAuth logins via Azure Active Directory.

License

Notifications You must be signed in to change notification settings

egomobile/azuread_login_view

Repository files navigation

pub package Publish

Flutter widget using webview_flutter and http, which provides one or more widgets to handle OAuth logins via Azure Active Directory.

import 'package:azuread_login_view/azuread_login_view.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyLoginExamplePage());
}

class MyLoginExamplePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final AzureADLoginViewOptions loginViewOptions = AzureADLoginViewOptionsBuilder()
      // setup required settings
      .setTenant("<TENANT-NAME-OR-ID>")
      .setClientId("<CLIENT-ID>")
      .setRedirectUri("<REDIRECT-URI>")
      .setLoginPolicy("<NAME-OF-LOGIN-POLICY>")
      .setOnNewTokens((AzureADLoginNewTokensHandlerContext context) {
         // s. `context.tokens`
       })

      // this is optional
      .setOnNavigationError((AzureADLoginNavigationErrorHandlerContext context) {
         // ...
       })

      .build();

    return MaterialApp(
      home: AzureADLoginView(loginViewOptions),
    );
  }
}

An example application can be found inside example folder.