Skip to content

Instantly share code, notes, and snippets.

View chetants22's full-sized avatar

Chetan Bhoyar chetants22

View GitHub Profile
@chetants22
chetants22 / js
Created June 10, 2024 13:35
Firebase import
#import <Firebase.h>
@chetants22
chetants22 / podfile
Created June 10, 2024 11:46
sample podfile
target 'ExampleApp' do
config = use_native_modules!
use_frameworks! :linkage => :static
$RNFirebaseAsStaticFramework = true
...
end
@chetants22
chetants22 / js
Created June 9, 2024 06:08
Authentication onClick button
import React from 'react';
import {Text, TouchableOpacity, Image, View} from 'react-native';
const App = () => {
return (
<View>
<TouchableOpacity onPress={onGoogleButtonPress}>
<View>
<Image source={images.googleIcon} />
</View>
@chetants22
chetants22 / js
Created June 9, 2024 05:53
googleSignIn
async function onGoogleButtonPress() {
try {
// Get the user's ID token
const { idToken } = await GoogleSignin.signIn();
// Create a Google credential with the token
const googleCredential = auth.GoogleAuthProvider.credential(idToken);
// Sign-in the user with the credential
return auth().signInWithCredential(googleCredential);
} catch (error) {
if (error.code === statusCodes.SIGN_IN_CANCELLED) {
@chetants22
chetants22 / js
Last active June 7, 2024 13:42
Initialize Firebase and Google Sign-In
import {GoogleSignin} from '@react-native-google-signin/google-signin';
import auth from '@react-native-firebase/auth';
const _signInWithGoogle = async () => {
try {
GoogleSignin.configure({
offlineAccess: false,
webClientId:
'YOUR_WEB_CLIENT_ID',
scopes: ['profile', 'email'],
@chetants22
chetants22 / bash
Created June 6, 2024 09:24
repo-update
pod install --repo-update
@chetants22
chetants22 / xml
Created June 6, 2024 09:05
AndroidManifest.xml
<meta-data
android:name="com.google.android.gms.auth.api.credentials.ClientId"
android:value="YOUR_WEB_CLIENT_ID" />
@chetants22
chetants22 / bash
Created June 6, 2024 09:01
pod file
pod 'Firebase/Auth'
pod 'GoogleSignIn'
apply plugin: 'com.google.gms.google-services'
@chetants22
chetants22 / gradle
Last active June 6, 2024 09:40
configuration
buildscript {
..........
...
dependencies {
........
classpath 'com.google.gms:google-services:4.3.3'
........
}
}