This commit is contained in:
2022-10-20 10:41:46 +02:00
parent 05f4a6c3ab
commit fd7b7de052
16 changed files with 681 additions and 62 deletions

34
screens/AuthScreen.tsx Normal file
View File

@@ -0,0 +1,34 @@
import * as React from 'react';
import * as WebBrowser from 'expo-web-browser';
import * as Google from 'expo-auth-session/providers/google';
import { Button } from 'react-native';
import {createContext, useState} from "react";
WebBrowser.maybeCompleteAuthSession();
export default function AuthScreen({authCallback} ) {
const [request, response, promptAsync] = Google.useAuthRequest({
expoClientId: '61386079886-2k3g6793pgt5pha4rhdojpvgrkuccfj7.apps.googleusercontent.com',
iosClientId: '61386079886-2k3g6793pgt5pha4rhdojpvgrkuccfj7.apps.googleusercontent.com',
androidClientId: '61386079886-2k3g6793pgt5pha4rhdojpvgrkuccfj7.apps.googleusercontent.com',
webClientId: '61386079886-2k3g6793pgt5pha4rhdojpvgrkuccfj7.apps.googleusercontent.com',
});
const AuthContext = useState()
React.useEffect(() => {
if (response?.type === 'success') {
const { authentication } = response;
// @ts-ignore
authCallback(authentication)
}
}, [response]);
return (
<Button
disabled={!request}
title="Login"
onPress={() => {
promptAsync();
}}
/>
);
}