パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.3.0

google_sign_in_dartio

Dartで構築されたGoogleログイン用のFlutterパッケージで、モバイルおよびデスクトップ環境をサポートしています。

AndroidiOSmacOS
30日間ダウンロード
9710
いいね数
29
Pub ポイント
150

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

flutter pub add google_sign_in_dartio

パッケージ概要

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

純粋なDartを使用してGoogleログインを可能にするFlutterパッケージで、Android、iOS、macOSをサポートしています。ネイティブコードに依存せずに、モバイルおよびデスクトップ環境での統合を簡素化するクロスプラットフォームの認証ソリューションを提供します。このパッケージは、FlutterアプリでGoogle認証を軽量かつ統一的なアプローチで実装したい開発者向けに設計されています。

用途

  • クロスプラットフォームアプリにおけるユーザー認証
  • モバイルおよびデスクトップ向けのログインフローの簡素化
  • FlutterアプリケーションにGoogleアカウントを統合する
  • ネイティブ依存関係なしで安全なサインインを有効にする
  • マルチプラットフォームID管理をサポート

主な機能

  • 純粋なDart実装
  • クロスプラットフォーム対応(Android、iOS、macOS)
  • ネイティブコードは不要です
  • 軽量で統合が簡単
  • OAuth2 トークンの組み込み処理

適している対象

  • 共有認証ロジックを使用して複数のプラットフォームをターゲットにする開発者
  • プラットフォーム固有のネイティブコードを避けるプロジェクト
  • デスクトップおよびモバイルでシームレスなGoogleログインを必要とするアプリ
  • 複数プラットフォーム間でのコードの一貫性を重視するチーム
  • Google認証に最小限のセットアップが必要なアプリケーション

注意事項

  • Googleサインインのみに制限
  • Google Cloud Consoleで適切な設定が必要です
  • プラットフォーム固有のSDKと比較して、機能が少ない場合があります
  • 認証にはインターネット接続に依存します
  • 基本的なサインインを超える複雑なOAuthワークフローには適していません

元の README

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

google_sign_in_dartio

A Flutter package that implements Google Sign In in pure Dart. This package is compatible with google_sign_in plugin and works on all platforms Flutter supports but it's intended to be mainly used on Desktop.

Getting Started

Install and initialization
  1. Depend on it
    dependencies:
      google_sign_in: ^4.1.4
      google_sign_in_dartio: ^0.0.6
    
  2. Run flutter pub get
  3. Import
    import 'package:google_sign_in/google_sign_in.dart';
    import 'package:google_sign_in_dartio/google_sign_in_dartio.dart';
    
  4. Register the package
    import 'package:flutter/material.dart';
    import 'package:google_sign_in/google_sign_in.dart';
    import 'package:google_sign_in_dartio/google_sign_in_dartio.dart';
    
    void main() {
      if (isDesktop) {
        GoogleSignInDart.register(clientId: <clientId>);
      }
    
      runApp(MyApp());
    }
    
    Note: You might want to await for the register method to finish before calling any GoogleSignIn methods when your app starts.
Usage

You can use the normal GoogleSignIn methods.

final GoogleSignInAccount account = await GoogleSignIn().signIn();

Obtain a Client ID for your Desktop app

  1. Go to the Google Cloud Platform console and select you project
  2. Go to APIs & Service -> Credentials
  3. Create new credentials for your app by selecting CREATE CREDENTIALS and then OAuth client ID
  4. Select Other as Application type, give it a name (eg. macOS) and then click Create
Provide a code exchange endpoint

The user accessToken expires after about one hour, after witch you need to ask the user to login again. If you want to keep the user logged in, you need to deploy a oAuth code exchange endpoint. Once you have your endpoint you can register the package like this.

NOTE:

If you use this only for FirebaseAuth you don't need the code exchange since the token must be valid only when you use the signInWithCredentials method.

    import 'package:flutter/material.dart';
    import 'package:google_sign_in/google_sign_in.dart';
    import 'package:google_sign_in_dartio/google_sign_in_dartio.dart';
    
    void main() {
      if (isDesktop) {
        GoogleSignInDart.register(
            clientId: <clientId>, 
            exchangeEndpoint: <endpoint>,
        );
      }
    
      runApp(MyApp());
    }
NOTE:

GoogleSignInTokenData exposes serverAuthCode field that should contain the exchange code from the authorization request. This will always be null when using this package because we already allow you to provide a code exchange endpoint witch exposes the code and code verifier in a trusted environment and encourages not to do the code exchange on the client.

See instruction on how to deploy a code exchange endpoint.

カテゴリー

依存関係

依存関係一覧 10 件

ソースリポジトリ

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

データはまだありません。