Skip to content

Instantly share code, notes, and snippets.

@asumansenol
Created April 3, 2020 15:48
Show Gist options
  • Save asumansenol/72a8182ca6f016acdf72ece0e6fcd96b to your computer and use it in GitHub Desktop.
Save asumansenol/72a8182ca6f016acdf72ece0e6fcd96b to your computer and use it in GitHub Desktop.
async signInWithGoogle() {
try {
const result = await Expo.Google.logInAsync({
androidClientId: ANDROID_CLIENT_ID,
iosClientId: IOS_CLIENT_ID,
behavior: 'web',
iosClientId: '', //enter ios client id
scopes: ['profile', 'email']
});
if (result.type === 'success') {
await firebase.auth().setPersistence(firebase.auth.Auth.Persistence.LOCAL);
const credential = firebase.auth.GoogleAuthProvider.credential(data.idToken, data.accessToken);
const googleProfileData = await firebase.auth().signInWithCredential(credential);
this.onLoginSuccess.bind(this);
}
} catch ({ message }) {
alert('login: Error:' + message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment