simplici_auth_flutter 1.0.0 copy "simplici_auth_flutter: ^1.0.0" to clipboard
simplici_auth_flutter: ^1.0.0 copied to clipboard

A Flutter package for integrating Simplici Auth with Google OAuth in Flutter applications. Provides webview-based authentication with customizable UI and comprehensive OAuth handling.

Simplici Auth Flutter #

A Flutter package for integrating Simplici Auth with Google OAuth in Flutter applications. This package provides webview-based authentication with customizable UI and comprehensive OAuth handling.

Features #

  • πŸ” Google OAuth Integration: Complete Google OAuth 2.0 flow with authorization code exchange
  • 🌐 WebView Authentication: Secure webview-based authentication
  • πŸ“± Cross-Platform: Works on iOS, Android, and Web
  • 🎨 Customizable UI: Fullscreen webview with custom styling
  • πŸ”„ Token Management: Automatic token exchange and refresh handling
  • πŸ“Š User Data: Complete user profile information retrieval
  • ⚑ Hook System: Integration with window.handleHooks for custom flows
  • πŸ›‘οΈ Error Handling: Comprehensive error handling and logging

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  simplici_auth_flutter: ^1.0.0

Then run:

flutter pub get

Usage #

Basic Usage #

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:simplici_auth_flutter/simplici_auth_flutter.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  
  // Hide system UI for fullscreen experience
  SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
  
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        scaffoldBackgroundColor: Colors.transparent,
      ),
      home: const SimpliciAuthWebView(),
    );
  }
}

Custom Implementation #

class CustomAuthScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Authentication')),
      body: const SimpliciAuthWebView(),
    );
  }
}

Configuration #

The package automatically handles:

  • Google OAuth Configuration: Receives instance details from the webcomponent
  • Token Exchange: Exchanges authorization codes for access tokens
  • User Information: Retrieves user profile data from Google
  • Hook Integration: Calls window.handleHooks with authentication data

Data Flow #

  1. Instance Details: Webcomponent sends Google OAuth configuration
  2. Authorization: User authenticates via Google OAuth
  3. Code Exchange: Authorization code is exchanged for access token
  4. Hook Call: window.handleHooks is called with authentication data
  5. User Data: Complete user information is retrieved and set as sso_user_data

Response Format #

The package sets sso_user_data with the following structure:

{
  "provider": "google",
  "access_token": "ya29.a0...",
  "code": "4/0AfJohX...",
  "redirect_url": "com.googleusercontent.apps...",
  "instanceId": "686792efe1934dbaa5b8c988",
  "type": "embeded",
  "responseType": "json",
  "refresh_token": "1//04...",
  "expires_in": 3599,
  "email": "user@example.com",
  "userId": "686d0c009e6a67af37701b79",
  "firstName": "John",
  "lastName": "Doe",
  "hook_result": {
    "statusCode": 200,
    "message": "ok",
    "data": { ... }
  }
}

Requirements #

  • Flutter SDK: >=1.17.0
  • Dart SDK: ^3.8.1

Dependencies #

  • webview_flutter: ^4.2.2
  • flutter_inappwebview: ^6.0.0
  • http: ^1.1.0

Platform Support #

Platform Support
Android βœ…
iOS βœ…
Web βœ…
macOS βœ…
Linux βœ…
Windows βœ…

Example #

Check out the example directory for a complete implementation.

Contributing #

Contributions are welcome! Please feel free to submit a Pull Request.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

Support #

If you have any questions or need help, please open an issue on GitHub.

1
likes
0
points
45
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for integrating Simplici Auth with Google OAuth in Flutter applications. Provides webview-based authentication with customizable UI and comprehensive OAuth handling.

Repository (GitHub)
View/report issues

Topics

#authentication #oauth #google #webview #simplici

License

unknown (license)

Dependencies

flutter, flutter_inappwebview, http, webview_flutter

More

Packages that depend on simplici_auth_flutter