패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.3.0

google_sign_in_dartio

Dart로 구현된 Google 로그인용 Flutter 패키지이며, 모바일 및 데스크톱 환경 모두를 지원합니다.

AndroidiOSmacOS
30일 다운로드
9.7천
좋아요
29
Pub 점수
150

패키지 설치

flutter pub add google_sign_in_dartio

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

순수한 Dart를 사용하여 Google 로그인을 가능하게 하는 Flutter 패키지로, Android, iOS 및 macOS를 지원합니다. 네이티브 코드에 의존하지 않고 모바일 및 데스크톱 환경에서의 통합을 단순화하는 크로스플랫폼 인증 솔루션을 제공합니다. 개발자들이 Flutter 앱에서 Google 인증을 가볍고 통합된 방식으로 구현하고자 할 때 적합하도록 설계되었습니다.

사용 사례

  • 크로스 플랫폼 앱에서의 사용자 인증
  • 모바일 및 데스크톱용 로그인 흐름 간소화
  • Flutter 애플리케이션에서 Google 계정 통합
  • 네이티브 종속성 없이 안전한 로그인 활성화
  • 다중 플랫폼 식별 관리 지원

주요 기능

  • 순수한 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 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.