Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

Merge branch 'main' into use_user_auth_type

Nathan76b9cbd44673
diff --cc frontend/appflowy_flutter/lib/startup/tasks/deeplink/login_deeplink_handler.dart
index 0000000000,5ed8073e2a..590ea97c26
mode 000000,100644..100644
--- a/frontend/appflowy_flutter/lib/startup/tasks/deeplink/login_deeplink_handler.dart
+++ b/frontend/appflowy_flutter/lib/startup/tasks/deeplink/login_deeplink_handler.dart
@@@ -1,0 -1,44 +1,44 @@@
+ import 'dart:async';
+
+ import 'package:appflowy/startup/tasks/deeplink/deeplink_handler.dart';
+ import 'package:appflowy/user/application/auth/auth_service.dart';
+ import 'package:appflowy/user/application/auth/device_id.dart';
+ import 'package:appflowy_backend/dispatch/dispatch.dart';
+ import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
+ import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart';
+ import 'package:appflowy_result/appflowy_result.dart';
+
+ class LoginDeepLinkHandler extends DeepLinkHandler<UserProfilePB> {
+ @override
+ bool canHandle(Uri uri) {
+ final containsAccessToken = uri.fragment.contains('access_token');
+ if (!containsAccessToken) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @override
+ Future<FlowyResult<UserProfilePB, FlowyError>> handle({
+ required Uri uri,
+ required DeepLinkStateHandler onStateChange,
+ }) async {
+ final deviceId = await getDeviceId();
+ final payload = OauthSignInPB(
- authenticator: AuthTypePB.Server,
++ authType: AuthTypePB.Server,
+ map: {
+ AuthServiceMapKeys.signInURL: uri.toString(),
+ AuthServiceMapKeys.deviceId: deviceId,
+ },
+ );
+
+ onStateChange(this, DeepLinkState.loading);
+
+ final result = await UserEventOauthSignIn(payload).send();
+
+ onStateChange(this, DeepLinkState.finish);
+
+ return result;
+ }
+ }