Created
April 3, 2020 15:48
-
-
Save asumansenol/72a8182ca6f016acdf72ece0e6fcd96b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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