Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/appsup-dart/firebase_admin
A pure Dart implementation of the Firebase admin sdk
https://github.com/appsup-dart/firebase_admin
firebase
Last synced: 2 days ago
JSON representation
A pure Dart implementation of the Firebase admin sdk
- Host: GitHub
- URL: https://github.com/appsup-dart/firebase_admin
- Owner: appsup-dart
- License: other
- Created: 2020-02-12T18:35:30.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-04T07:03:10.000Z (4 months ago)
- Last Synced: 2024-12-15T19:13:48.492Z (9 days ago)
- Topics: firebase
- Language: Dart
- Homepage:
- Size: 102 KB
- Stars: 44
- Watchers: 5
- Forks: 51
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
A pure Dart implementation of the Firebase admin sdk
Currently, only supports admin methods for the following firebase services:
* authentication
* realtime database## Example using service account
```dart
import 'package:firebase_admin/firebase_admin.dart';main() async {
var app = FirebaseAdmin.instance.initializeApp(AppOptions(
credential: ServiceAccountCredential('service-account.json'),
));var link = await app.auth().generateSignInWithEmailLink('[email protected]',
ActionCodeSettings(url: 'https://example.com'));print(link);
}
```
## Example using default credentials```dart
import 'package:firebase_admin/firebase_admin.dart';
import 'package:firebase_admin/src/credential.dart';void main() async {
// applicationDefault() will look for credentials in the following locations:
// * the env variable GOOGLE_APPLICATION_CREDENTIALS
// * a configuration file, specific for this library, stored in the user's home directory
// * gcloud's application default credentials
// * credentials from the firebase tools
var credential = Credentials.applicationDefault();// when no credentials found, login using openid
// the credentials are stored on disk for later use
credential ??= await Credentials.login();// create an app
var app = FirebaseAdmin.instance.initializeApp(AppOptions(
credential: credential ?? Credentials.applicationDefault(),
projectId: 'some-project'));try {
// get a user by email
var v = await app.auth().getUserByEmail('[email protected]');
print(v.toJson());
} on FirebaseException catch (e) {
print(e.message);
}
}```
## Features and bugs
Please file feature requests and bugs at the [issue tracker][tracker].
[tracker]: https://github.com/appsup-dart/firebase_admin/issues
## Sponsor
Creating and maintaining this package takes a lot of time. If you like the result, please consider to [:heart: sponsor](https://github.com/sponsors/rbellens).
With your support, I will be able to further improve and support this project.
Also, check out my other dart packages at [pub.dev](https://pub.dev/packages?q=publisher%3Aappsup.be).