masamune_auth_firebase 3.1.6
masamune_auth_firebase: ^3.1.6 copied to clipboard
Plug-in package for server-side integration of Firebase Authentication.
Masamune Auth Firebase
[GitHub] | [YouTube] | [Packages] | [X] | [LinkedIn] | [mathru.net]
Masamune Auth Firebase #
Overview #
masamune_auth_firebase provides server-side integration utilities for Firebase Authentication in Masamune apps. This package focuses on backend operations that cannot be safely performed on the client side.
Note: This package does NOT include a client-side auth adapter. For Firebase Authentication adapters, see:
katana_auth_firebase- Core Firebase Auth adaptermasamune_auth_google_firebase- Google Sign-In with Firebasemasamune_auth_apple_firebase- Apple Sign-In with Firebasemasamune_auth_github_firebase- GitHub Sign-In with Firebase
Usage #
Installation #
Add the package to your project.
flutter pub add masamune_auth_firebase
Run flutter pub get after editing pubspec.yaml manually.
Delete User with Functions Action #
This package provides FirebaseDeleteUserFunctionsAction for securely deleting Firebase Authentication users from your backend.
Client-side usage:
import 'package:masamune_functions/masamune_functions.dart';
import 'package:masamune_auth_firebase/masamune_auth_firebase.dart';
// In your controller or page
final functions = ref.app.functions();
Future<void> deleteUserAccount(String uid) async {
try {
final response = await functions.execute(
FirebaseDeleteUserFunctionsAction(userId: uid),
);
// User deleted successfully
} catch (e) {
debugPrint("Failed to delete user: $e");
rethrow;
}
}
Server-side implementation:
Your Masamune Functions backend should handle the delete_user action:
// In your Cloud Functions or backend
if (action == "delete_user") {
final userId = data["userId"];
// Authenticate the request
// Verify user has permission to delete this account
// Delete using Firebase Admin SDK
await admin.auth().deleteUser(userId);
return {"success": true};
}
The action sends { "userId": uid } to your backend and expects an empty response (or throws an exception on failure).
Authentication Flow #
For complete Firebase Authentication integration, combine with:
- Core Auth:
katana_auth_firebasefor basic Firebase Auth - Sign-In Methods: Platform-specific packages like:
masamune_auth_google_firebase(Google Sign-In)masamune_auth_apple_firebase(Apple Sign-In)masamune_auth_github_firebase(GitHub Sign-In)
- Server Operations: This package (
masamune_auth_firebase) for secure backend operations
GitHub Sponsors #
Sponsors are always welcome. Thank you for your support!