azure_auth 1.0.1 copy "azure_auth: ^1.0.1" to clipboard
azure_auth: ^1.0.1 copied to clipboard

Flutter package for handling authentication using **Azure Active Directory B2C**, supporting **Facebook**, **Google**, **Email/Password**, and **Phone** sign-in through Azure's identity providers.

Azure AD B2C Authentication for Flutter #

A Flutter package for handling authentication using Azure Active Directory B2C, supporting Facebook, Google, Email/Password, and Phone sign-in through Azure's identity providers.

Features #

  • Azure AD B2C OAuth2 support
  • Integrates with external identity providers (Facebook, Google, etc.)
  • Secure token storage using flutter_secure_storage
  • Supports callback handling via app_links or custom URI schemes
  • Modular and easily customizable

Getting started #

Usage #

To use `azure_Auth`:

dependencies:
 flutter:
 sdk: flutter
 azure_auth: ^0.0.7

To import dynamic_icons_matte:

import 'package:azure_auth/vsauth.dart';

Update in main.m like below #

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final AppLinks _appLinks = AppLinks();
  StreamSubscription<Uri>? _linkSubscription;
  late final AuthCubit _authCubit; // πŸ‘ˆ make it accessible

  final authenticationNotifierProvider =
  NotifierProvider<AuthenticationNotifier, AuthenticationState>(
    AuthenticationNotifier.new,
  );
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    _authCubit = AuthCubit( // πŸ‘ˆ initialize it here
      clientId: "xxxxxxxxxxxxxxxx",
      redirectUri: "xxxxxxxxxxxxxxxx",
      scope: "openid profile email offline_access",
    );
    initDeepLinks();
  }

  Future<void> initDeepLinks() async {
    CupertinoActivityIndicator(animating: true,);
    // Handle links
    _linkSubscription = AppLinks().uriLinkStream.listen((uri) async{
      debugPrint('onAppLink: $uri');
      Uri.parse(uri.toString());
      if (uri.toString().contains('vsauth/?code')) {
           // handle navigation and otherthings
        Map<String, dynamic>? userData = await  _authCubit?.getAuthrorisationCode(uri);
        //In userData you will get all return response from facebook, google and azure
        debugPrint("User data is in main project ${userData}");
        CupertinoActivityIndicator(animating: false,);
      }
      //openAppLink(uri);
    });
  }

  @override
  Widget build(BuildContext context) {
    final authNotifier = ref.read(authenticationNotifierProvider.notifier);

    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home:  AuthScreen(
        authCubit: authNotifier.createAuthCubitObject(), // πŸ‘ˆ Works as before
        onLoginSuccess: () => closeLoginBottomSheet(context),
        fb_flowName: "B2C_1_xxxxxxxx",
        google_flowName: "B2C_1_xxxxxxx",
        email_phone_flowName: "B2C_1_xxxxxxxxx",
      ),
    );
  }
}

Additional information #

Azure AD B2C Docs

For support, file issues or pull requests on GitHub.

This package is maintained and updated regularly.

1
likes
110
points
136
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter package for handling authentication using **Azure Active Directory B2C**, supporting **Facebook**, **Google**, **Email/Password**, and **Phone** sign-in through Azure's identity providers.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

app_links, auto_route, dart_jsonwebtoken, dio, flutter, flutter_bloc, flutter_secure_storage, flutter_svg, flutter_web_auth_2, form_validator, get, google_fonts, json_serializable

More

Packages that depend on azure_auth