Skip to content
pubscout

googleapis_auth

2.3.7, released 13 days ago by google.dev

Obtain Access credentials and authenticated HTTP clients for Google APIs using OAuth 2.0.

WASM-readyRock solid
$ flutter pub add googleapis_auth
Source repository

What it does

Provides support for obtaining OAuth 2.0 credentials, service account authentications, and automatically refreshing credentials to access Google APIs. Note that this package explicitly warns against direct use with Flutter applications.

AI-written summary of version 2.3.7, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You are building a Dart command-line tool or server-side application that needs to authenticate with Google APIs.
  • You need to use Application Default Credentials (ADC) or Service Accounts in a Dart backend.

Skip it when

  • You are developing a Flutter application (use package:extension_google_sign_in_as_googleapis_auth instead).

Strengths

  • Supports multiple credential types like Service Accounts, API keys, and Application Default Credentials.
  • Automatically refreshes OAuth 2.0 credentials.

Weaknesses

  • Not recommended for use inside Flutter apps due to dedicated platform packages.
  • Requires manual GCP console configuration and credential file setup.

Setup

Kind
Pure Dart
Effort
Medium
Code generation
No
Direct dependencies
6

Requires creating a Google Cloud project, enabling necessary APIs, and creating appropriate credentials (Service Account JSON, OAuth Client ID, or API key) in the Google Cloud Console.

import 'package:googleapis_auth/auth_io.dart';

Future<void> main() async {
  final client = await clientViaApplicationDefaultCredentials(
    scopes: ['https://www.googleapis.com/auth/cloud-platform'],
  );
  client.close();
}

Alternatives

Packages that do the same job and could replace googleapis_auth.

Works with

Packages commonly used together with googleapis_auth: ones it builds on, ones built on it, and its own family.