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.