Open larixer opened 5 years ago
i want to work on this issue
i dont have any experince its my first contribution
Set Up Google Developer Console:
Go to the Google Developer Console. Create a new project or use an existing one. Enable the "Google Sign-In" API for your project. Configure the OAuth consent screen and add necessary information like application name, support email, etc. Create OAuth 2.0 credentials and set the authorized JavaScript origins and redirect URIs. For Expo apps, the redirect URI will be something like https://auth.expo.io/@your-username/your-app-slug
import Constants from 'expo-constants';
const GOOGLE_ANDROID_CLIENT_ID = 'YOUR_ANDROID_CLIENT_ID'; const GOOGLE_IOS_CLIENT_ID = 'YOUR_IOS_CLIENT_ID';
Constants.manifest.extra = { androidClientId: GOOGLE_ANDROID_CLIENT_ID, iosClientId: GOOGLE_IOS_CLIENT_ID, };
import * as GoogleSignIn from 'expo-google-sign-in';
// ...
const handleGoogleSignIn = async () => { try { await GoogleSignIn.initAsync({ clientId: Constants.manifest.extra.androidClientId, }); await GoogleSignIn.askForPlayServicesAsync(); const { type, user } = await GoogleSignIn.signInAsync(); if (type === 'success') { // User signed in successfully, handle the user object console.log(user); } else { // User cancelled the login request console.log('Google Sign-In cancelled.'); } } catch (error) { // Handle error console.error(error); } };
// ...
Add native Expo Google API integration for login as a module next to WebBrowser implementation, e.g.
auth/expo-google
next toauth/google
Relevant docs: https://docs.expo.io/versions/v31.0.0/sdk/google