Created
August 28, 2019 10:19
-
-
Save mdshadman/a3b1c33ec5a57df8e6c2975d8a3f030b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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