Skip to content

Instantly share code, notes, and snippets.

@vadiraja
vadiraja / FBSignOut.js
Created March 18, 2020 22:44
Amplify Social Login Sign Out button
<View>
<Button onPress={() => Auth.signOut({ global: true })} transparent>
<Icon type="FontAwesome" name="sign-out" style={{color: 'white'}}/>
</Button>
</View>
@vadiraja
vadiraja / FBButton.js
Last active March 18, 2020 22:16
Facebook Button with Auth Sign In call
<View style={styles.containFbBg}>
<Button
onPress={() => Auth.federatedSignIn({provider: 'Facebook'})}
iconRight
style={styles.fbButton}
>
<FontAwesome name="facebook" size={28} color="#ffffff" />
<Text style={styles.fbButtonText}>Sign in with facebook</Text>
</Button>
</View>
@vadiraja
vadiraja / NavigationSwitch.js
Created March 18, 2020 19:26
Load screens based on user auth status
<NavigationContainer>
<Stack.Navigator
headerMode="screen"
screenOptions={{
headerTintColor: 'white',
headerStyle: styles.header,
}}
>
{this.state.isLoggedIn ? (
<>
@vadiraja
vadiraja / AuthScreen.js
Last active January 25, 2021 16:52
Oauth configuration and URL Opener for social login
import { Linking } from 'expo';
import * as WebBrowser from 'expo-web-browser';
/**Amplify documentation has this example */
const urlOpenerExpo = async (url, redirectUrl) => {
console.log(">>>>>>>>> in urlOpener")
// On Expo, use WebBrowser.openAuthSessionAsync to open the Hosted UI pages.
const { type, url: newUrl } = await WebBrowser.openAuthSessionAsync(url, redirectUrl);
console.log("Type")