Created
October 26, 2017 06:18
-
-
Save mshk/584dd0e91acef564d5276bbf9b386a43 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
import { firebaseAuth, firebaseDb } from '../../lib/firebase' | |
constructor(props) { | |
super(props) | |
this.provider = new firebaseAuth.TwitterAuthProvider() | |
} | |
handleTwitterLogin(event) { | |
firebaseAuth().signInWithPopup(this.provider) | |
.then((result) => { | |
firebaseDb.ref('credentials/' + result.user.uid) | |
.set({ | |
userId: result.user.uid, | |
twitterAccessToken: result.credential.accessToken, | |
twitterSecret: result.credential.secret, | |
twitterIdStr: result.additionalUserInfo.profile.id_str | |
}) | |
}) | |
.catch((error) => { | |
console.error("Firebase sign-in error:", error) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment