googleapis_auth_default_credentials 0.1.0 copy "googleapis_auth_default_credentials: ^0.1.0" to clipboard
googleapis_auth_default_credentials: ^0.1.0 copied to clipboard

Dart 1 only

An implementation of application default credentials for Dart.

googleapis_auth_default_credentials #

This package provides an implementation of application default credentials for Dart.

The Application Default Credentials provide a simple way to get authorization credentials for use in calling Google APIs.

They are best suited for cases when the call needs to have the same identity and authorization level for the application independent of the user. This is the recommended approach to authorize calls to Cloud APIs, particularly when you're building an application that uses Google Compute Engine.

Example #

import 'package:http/http.dart';
import 'package:googleapis_auth_default_credentials/googleapis_auth_default_credentials.dart';
import 'package:googleapis_auth/auth_io.dart';
import 'package:googleapis/storage/v1.dart';

const _SCOPES = const [StorageApi.DevstorageReadOnlyScope];

main() async {
  Client client = new Client();
  AccessCredentials credentials = await obtainDefaultAccessCredentials(_SCOPES, client);
  AuthClient authClient = authenticatedClient(client, credentials);
  final storage = new StorageApi(authClient);
  final buckets = await storage.buckets.list('test');
  print(buckets.toJson());
  client.close();
}
0
likes
40
points
11
downloads

Publisher

unverified uploader

Weekly Downloads

An implementation of application default credentials for Dart.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

googleapis, googleapis_auth, http, path

More

Packages that depend on googleapis_auth_default_credentials