Skip to content

Instantly share code, notes, and snippets.

@mdshadman
Created August 28, 2019 10:19
Show Gist options
  • Save mdshadman/a3b1c33ec5a57df8e6c2975d8a3f030b to your computer and use it in GitHub Desktop.
Save mdshadman/a3b1c33ec5a57df8e6c2975d8a3f030b to your computer and use it in GitHub Desktop.
twitterLogin = async () => {
try {
await RNTwitterSignIn.init(TwitterKeys.TWITTER_CONSUMER_KEY, TwitterKeys.TWITTER_CONSUMER_SECRET);
// also includes: name, userID & userName
const { authToken, authTokenSecret } = await RNTwitterSignIn.logIn();
const credential = TwitterAuthProvider.credential(authToken, authTokenSecret);
const firebaseUserCredential = await firebase.auth().signInWithCredential(credential);
if (firebaseUserCredential) {
this.setState({
isLoggedIn: true
})
}
console.warn(JSON.stringify(firebaseUserCredential.user.toJSON()));
} catch (e) {
console.error(e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment