Initial commit
Generated by create-expo-app 3.3.0.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import { Text, View } from 'react-native';
|
||||
import { useRouter } from 'expo-router';
|
||||
import * as WebBrowser from 'expo-web-browser';
|
||||
import { Platform } from 'react-native';
|
||||
|
||||
/**
|
||||
* This component handles authentication callbacks on web platforms.
|
||||
* It's designed to process the authentication response and close the browser window
|
||||
* after a successful authentication flow.
|
||||
*/
|
||||
export default function WebAuthCallback() {
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
// Handle the auth callback
|
||||
const handleCallback = async () => {
|
||||
try {
|
||||
// Close the auth session and return to the app
|
||||
if (Platform.OS === 'web') {
|
||||
WebBrowser.maybeCompleteAuthSession();
|
||||
}
|
||||
|
||||
// Navigate back to the main app after a short delay
|
||||
setTimeout(() => {
|
||||
router.replace('/');
|
||||
}, 1000);
|
||||
} catch (error) {
|
||||
console.error('Error handling auth callback:', error);
|
||||
}
|
||||
};
|
||||
|
||||
handleCallback();
|
||||
}, [router]);
|
||||
|
||||
return (
|
||||
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
||||
<Text>Authentication complete. Redirecting...</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user