Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kseo/googleapis_auth_default_credentials
An implementation of application default credentials for Dart.
https://github.com/kseo/googleapis_auth_default_credentials
Last synced: 27 days ago
JSON representation
An implementation of application default credentials for Dart.
- Host: GitHub
- URL: https://github.com/kseo/googleapis_auth_default_credentials
- Owner: kseo
- License: bsd-3-clause
- Created: 2016-10-06T09:52:46.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-10-07T02:59:57.000Z (about 8 years ago)
- Last Synced: 2023-08-20T22:15:41.170Z (about 1 year ago)
- Language: Dart
- Homepage: https://pub.dartlang.org/packages/googleapis_auth_default_credentials
- Size: 9.77 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```dart
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();
}
```