カテゴリー・パッケージ・リポジトリを検索

パッケージ詳細v2.1.5

firebase_auth_rest

REST をベースにした、プラットフォームに依存しない Dart/Flutter ラッパー、Firebase 認証 API 用

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
292
いいね数
23
Pub ポイント
150

パッケージをインストール

flutter pub add firebase_auth_rest

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

プラットフォームに依存しないDart/Flutterラッパーで、Firebase Authentication REST APIを提供し、Android、iOS、Web、macOS、Windows、Linuxでスムーズな認証を可能にします。FirebaseのRESTエンドポイントをクリーンで使いやすいインターフェースに抽象化しており、ネイティブSDKの導入は不要です。最小限のセットアップでクロスプラットフォーム認証を実現し、認証フローを完全に制御したい開発者に最適です。このパッケージは軽量であり、ネイティブFirebase SDKが利用できない環境でも信頼性高く動作するように設計されています。

用途

  • クロスプラットフォーム認証
  • サーバーサイド認証統合
  • Web およびデスクトップアプリ認証
  • カスタム認証フロー
  • オフライン優先のアプリケーション

主な機能

  • RESTベースのFirebase統合
  • マルチプラットフォーム対応
  • ネイティブSDKの依存関係なし
  • シンプルな API サーフェス
  • セキュアなトークン処理

適している対象

  • 複数のプラットフォームをターゲットにする開発者
  • ネイティブなFirebase SDKを使用しないプロジェクト
  • 認証の細かい制御が必要なアプリ
  • バックエンド統合型のFlutterアプリ
  • 軽量認証ソリューション

注意事項

  • リフレッシュトークンの手動管理が必要です
  • REST API 機能に制限されています
  • 組み込みのUIコンポーネントなし
  • ネットワークの利用可能性に依存します
  • REST呼び出しには適切なエラーハンドリングが必要です

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

firebase_auth_rest

CI/CD Pub Version

A platform independent Dart/Flutter Wrapper for the Firebase Authentication API based on REST

Features

  • Pure Dart-based implementation
    • works on all platforms supported by dart
  • Uses the official REST-API endpoints
  • Provides high-level classes to manage authentication and users
  • Supports multiple parallel Logins of different users
  • Supports automatic background refresh
  • Supports all login methods
  • Proivides low-level REST classes for direct API access (import firebase_auth_rest/rest.dart)

Installation

Simply add firebase_auth_rest to your pubspec.yaml and run pub get (or flutter pub get).

Usage

The libary consists of two primary classes - the FirebaseAuth and the FirebaseAccount. You can use the FirebaseAuth class to perform "global" API actions that are not directly tied to a logged in user - This are things like creating accounts and signing in a user, but also functions like resetting a password that a user has forgotten.

The sign in/up methods of FirebaseAuth will provide you with a FirebaseAccount. It holds the users authentication data, like an ID-Token, and can be used to perform various account related operations, like changing the users email address or getting the full user profile. It also automatically refreshes the users credentials shortly before timeout - allthough that can be disabled and done manually.

Thw following code is a simple example, which can be found in full length, including errorhandling, at https://pub.dev/packages/firebase_auth_rest/example. It loggs into firebase as anonymous user, prints credentials and account details and then proceeds to permanently delete the account.

// Create auth instance and sign up as anonymous user
final fbAuth = FirebaseAuth(Client(), "API-KEY");
final account = await fbAuth.signUpAnonymous();

// print credentials und user details
print("Local-ID: ${account.localId}");
final userInfo = await account.getDetails();
print("User-Info: $userInfo");

// delete and dispose the account
await account.delete();
account.dispose();

Documentation

The documentation is available at https://pub.dev/documentation/firebase_auth_rest/latest/. A full example can be found at https://pub.dev/packages/firebase_auth_rest/example.

Testing

If you intend to run the integration tests, you will have to create a firebase project with the authentication enabled. You must enable E-Mail and anonymous authentication and disable the E-Mail enumeration protection. Note: This is only required to run the integration tests. For a normal firebase project you should never disable E-Mail enumeration protection. Finally, you have to create a .env file with the FIREBASE_API_KEY from the project.

Alternatively you can use the firebase emulator for testing. In that case, you will have to set the FIREBASE_EMULATOR_HOST and FIREBASE_EMULATOR_PORT in the .env file as well.

カテゴリー

依存関係

依存関係一覧 3 件

ソースリポジトリ

このパッケージを使用しているプロジェクト