Fixed google auth redirect for android

This commit is contained in:
Marc Rejohn Castillano 2026-02-10 23:58:34 +08:00
parent 01c6b3537c
commit 747edbdd8c
2 changed files with 14 additions and 1 deletions

View File

@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:label="tasq"
android:name="${applicationName}"
@ -26,6 +27,14 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="io.supabase.tasq"
android:host="login-callback" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->

View File

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
@ -61,7 +63,9 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
Future<void> _handleOAuthSignIn({required bool google}) async {
setState(() => _isLoading = true);
final auth = ref.read(authControllerProvider);
final redirectTo = kIsWeb ? Uri.base.origin : null;
final redirectTo = kIsWeb
? Uri.base.origin
: (Platform.isAndroid ? 'io.supabase.tasq://login-callback' : null);
try {
if (google) {