google_oauth2 1.0.3 copy "google_oauth2: ^1.0.3" to clipboard
google_oauth2: ^1.0.3 copied to clipboard

A Dart library for generating OAuth 2.0 access tokens for Google APIs using JSON service account credentials.

A Dart library for generating OAuth 2.0 access tokens for Google APIs based on JSON service account credentials.

Usage #

The package provides a flexible, extensible interface through generator functions:

final Map<String, dynamic> json = {/*content of google-services.json*/};
final scopesToTokenGenerator = genTokenFromJson(json);

final scopes = [
    'https://www.googleapis.com/auth/cloud-platform',
    'https://www.googleapis.com/auth/firebase.messaging',
];

final tokenGenerator = scopesToTokenGenerator(scopes);

final accessToken = await tokenGenerator.generate();

Don't forget to handle any errors.

1
likes
150
points
64
downloads

Publisher

verified publishersevasnex.dev

Weekly Downloads

A Dart library for generating OAuth 2.0 access tokens for Google APIs using JSON service account credentials.

Repository (GitHub)
View/report issues

Topics

#oauth #google-apis

Documentation

API reference

License

MIT (license)

Dependencies

http, pointycastle

More

Packages that depend on google_oauth2