mirror of
https://github.com/mudabbir-ahmad/Media-Aggregation-and-Sorting-System.git
synced 2026-10-07 19:40:20 +00:00
enhance Google OAuth handling by adding deep link redirect support; update comments for clarity
This commit is contained in:
1 parent
d865708e28
commit
eaa0a38a44
2 files changed
+8
-5
No files matched your search
@@ -4,6 +4,7 @@ import { NavigationContainer } from '@react-navigation/native';
|
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
||||
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
||||
import { ActivityIndicator, View, Text, TouchableOpacity } from 'react-native';
|
||||
import * as WebBrowser from 'expo-web-browser';
|
||||
import { ThemeProvider, useTheme } from './src/services/ThemeContext';
|
||||
import DatabaseService from './src/services/DatabaseService';
|
||||
import LoginScreen from './src/screens/LoginScreen';
|
||||
@@ -14,6 +15,9 @@ import SearchScreen from './src/screens/SearchScreen';
|
||||
import CollectionsScreen from './src/screens/AlbumsScreen';
|
||||
import SettingsScreen from './src/screens/SettingsScreen';
|
||||
|
||||
// Required for OAuth deep link redirect to close the browser and return to the app
|
||||
WebBrowser.maybeCompleteAuthSession();
|
||||
|
||||
const Stack = createNativeStackNavigator();
|
||||
const Tab = createBottomTabNavigator();
|
||||
|
||||
|
||||
@@ -6,10 +6,9 @@ WebBrowser.maybeCompleteAuthSession();
|
||||
|
||||
const GOOGLE_CLIENT_ID = '313090284964-rgq1u7np6ogucu9o97s134n5nc6nj7kf.apps.googleusercontent.com';
|
||||
|
||||
// makeRedirectUri uses the scheme from app.json ("media-aggregation") to build
|
||||
// the deep link URI that Android will route back into the app after OAuth.
|
||||
// The resulting URI is: media-aggregation:// (registered in Google Cloud Console)
|
||||
// For Expo Go dev testing the loopback http://localhost is used instead.
|
||||
// Builds the deep link redirect URI from the scheme defined in app.json ("media-aggregation").
|
||||
// On an Android APK this resolves to: media-aggregation://
|
||||
// Register this URI in Google Cloud Console → Authorized redirect URIs.
|
||||
const REDIRECT_URI = AuthSession.makeRedirectUri({ scheme: 'media-aggregation' });
|
||||
|
||||
const GOOGLE_DISCOVERY = {
|
||||
@@ -91,7 +90,7 @@ class GoogleAUTH extends AuthServiceBase {
|
||||
return {
|
||||
success: true,
|
||||
accessToken: this.accessToken,
|
||||
refreshToken: null,
|
||||
refreshToken: this.refreshToken,
|
||||
email: this.email,
|
||||
};
|
||||
} catch (error) {
|
||||
|
||||
Reference in new issue
Block a user