Skip to content

Commit 4da608c

Browse files
committed
Open in app browser, fallback to external browser if that does not work
1 parent 65050f3 commit 4da608c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/src/model/auth/auth_repository.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class AuthRepository {
5353
},
5454
);
5555

56-
final launched = await launchUrl(authUrl, mode: .externalApplication);
56+
final launched = await launchUrl(authUrl, mode: .inAppBrowserView);
5757
if (!launched) {
5858
throw Exception('Could not open browser for authentication.');
5959
}
@@ -64,6 +64,11 @@ class AuthRepository {
6464
.first
6565
.timeout(const Duration(minutes: 5));
6666

67+
// Dismiss the in-app browser (SFSafariViewController on iOS).
68+
// On Android, Chrome Custom Tabs close automatically when the intent is
69+
// intercepted; this call is a no-op in that case.
70+
await closeInAppWebView();
71+
6772
final returnedState = callbackUri.queryParameters['state'];
6873
if (returnedState != state) {
6974
throw Exception('OAuth state mismatch.');

0 commit comments

Comments
 (0)