Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
## 2.2.0

Upgraded to support generating email action links.
Generates the out of band email action link to sign in or sign up the owner of the specified email.

```dart
final app = FirebaseAdmin.instance.initializeApp();

final emailLink = app.auth().generateSignInWithEmailLink(
'[email protected]',
ActionCodeSettings(
url: 'https://example.com',
handleCodeInApp: true,
iOS: ActionCodeSettingsiOS(
bundleId: 'com.example',
),
android: ActionCodeSettingsAndroid(
packageName: 'com.example',
installApp: true,
minimumVersion: '42',
),
dynamicLinkDomain: 'example.page.link',
),
);
```

## 2.1.0

Upgraded to support firebase-admin Messaging features to send cloud message payloads to device, topic, all, multicast, and subscribe/unsubscribe from topic.
Expand Down
21 changes: 19 additions & 2 deletions lib/src/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import 'bindings.dart'
CreateUserRequest,
UpdateUserRequest,
ListUsersResult,
DecodedIdToken;
DecodedIdToken,
ActionCodeSettings,
ActionCodeSettingsiOS,
ActionCodeSettingsAndroid;

export 'bindings.dart'
show
Expand All @@ -24,7 +27,10 @@ export 'bindings.dart'
UpdateUserRequest,
ListUsersResult,
DecodedIdToken,
FirebaseSignInInfo;
FirebaseSignInInfo,
ActionCodeSettings,
ActionCodeSettingsiOS,
ActionCodeSettingsAndroid;

class Auth {
Auth(this.nativeInstance);
Expand Down Expand Up @@ -128,4 +134,15 @@ class Auth {
return promiseToFuture(nativeInstance.verifyIdToken(idToken));
}
}

/// Generates the out of band email action link to sign in or sign up the owner
/// of the specified email. The
/// [ActionCodeSettings] object provided
/// as an argument to this method defines whether the link is to be handled by a
/// mobile app or browser along with additional state information to be passed in
/// the deep link, etc.
Future<String> generateSignInWithEmailLink(
String email, ActionCodeSettings actionCodeSettings) =>
promiseToFuture(nativeInstance.generateSignInWithEmailLink(
email, actionCodeSettings));
}
57 changes: 57 additions & 0 deletions lib/src/bindings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,15 @@ abstract class Auth {
/// [DecodedIdToken]; otherwise, the promise is rejected. An optional flag can
/// be passed to additionally check whether the ID token was revoked.
external Promise verifyIdToken(String idToken, [bool checkRevoked]);

/// Generates the out of band email action link to sign in or sign up the owner
/// of the specified email. The
/// [ActionCodeSettings] object provided
/// as an argument to this method defines whether the link is to be handled by a
/// mobile app or browser along with additional state information to be passed in
/// the deep link, etc.
external Promise generateSignInWithEmailLink(
String email, ActionCodeSettings actionCodeSettings);
}

@JS()
Expand Down Expand Up @@ -338,6 +347,54 @@ abstract class UpdateUserRequest {
});
}

@JS()
@anonymous
abstract class ActionCodeSettings {
external String get url;

external bool get handleCodeInApp;

external ActionCodeSettingsiOS get iOS;

external ActionCodeSettingsAndroid get android;

external String get dynamicLinkDomain;

external factory ActionCodeSettings({
String url,
bool handleCodeInApp,
ActionCodeSettingsiOS iOS,
ActionCodeSettingsAndroid android,
String dynamicLinkDomain,
});
}

@JS()
@anonymous
abstract class ActionCodeSettingsiOS {
external String get bundleId;

external factory ActionCodeSettingsiOS({
String bundleId,
});
}

@JS()
@anonymous
abstract class ActionCodeSettingsAndroid {
external String get packageName;

external bool get installApp;

external String get minimumVersion;

external factory ActionCodeSettingsAndroid({
String packageName,
bool installApp,
String minimumVersion,
});
}

/// Interface representing a user.
@JS()
@anonymous
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: firebase_admin_interop
description: Firebase Admin SDK for Dart written as a wrapper around official Node.js SDK.
version: 2.1.0
version: 2.2.0
homepage: https://github.com/pulyaevskiy/firebase-admin-interop
author: Anatoly Pulyaevskiy <[email protected]>

Expand Down