Skip to content

Instantly share code, notes, and snippets.

@bearkfear
Created June 10, 2021 19:49
Show Gist options
  • Save bearkfear/1fa3eed6c28cacc47cdfd8b50ce568c5 to your computer and use it in GitHub Desktop.
Save bearkfear/1fa3eed6c28cacc47cdfd8b50ce568c5 to your computer and use it in GitHub Desktop.
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';
WebBrowser.maybeCompleteAuthSession();
export default function App() {
const [request, response, promptAsync] = Google.useAuthRequest({
expoClientId: 'GOOGLE_GUID.apps.googleusercontent.com',
iosClientId: 'GOOGLE_GUID.apps.googleusercontent.com',
androidClientId: 'GOOGLE_GUID.apps.googleusercontent.com',
webClientId: 'GOOGLE_GUID.apps.googleusercontent.com',
});
React.useEffect(() => {
if (response?.type === 'success') {
const { authentication } = response;
}
}, [response]);
return (
<Button
disabled={!request}
title="Login"
onPress={() => {
promptAsync();
}}
/>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment