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.
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.
- flutter_web_auth_2
Flutter plugin for authenticating a user with a web service.
93Compare - google_sign_in_ios
iOS and macOS implementation of Google Sign-In for Flutter
90Compare - google_sign_in_android
Android implementation of the google_sign_in plugin
88Compare - firebase_ui_oauth
Firebase UI OAuth widgets for authentication with social providers
84Compare
Works with
Packages commonly used together with googleapis_auth: ones it builds on, ones built on it, and its own family.
- cryptogoogleapis_auth depends on itProvides SHA, MD5, and HMAC hashing functions for Dart.
- http_parsergoogleapis_auth depends on itA platform-independent package for parsing and serializing HTTP formats.
- google_cloudgoogleapis_auth depends on itUtilities for running Dart code correctly on the Google Cloud Platform.
- google_identity_services_webgoogleapis_auth depends on itDart JS-interop wrapper for Google Identity Services Web SDK
- googleapisSame familyAuto-generated client libraries for accessing Google APIs.
- googleapis_betaSame familyAuto-generated client libraries for accessing Google APIs.
- grpcBuilt on googleapis_authDart implementation of gRPC, a high performance universal RPC framework.
- extension_google_sign_in_as_googleapis_authBuilt on googleapis_authCreates googleapis_auth AuthClient from GoogleSignIn credentials.