Hi everyone, in the previous post we talked about "Google login with Ionic and Firebase"; assuming you already know a bit about Firebase and how to configure it in your ionic app "Quick Start with Ionic + Firebase", let's see how to setup Twitter login.

Start first by creating a Twitter app at https://apps.twitter.com. You will be required to sign-in with your Twitter account.

Once you already have a Twitter app, select Keys and Access Tokens and _retrieve your Twitter app's Consumer Key (API Key) and Consumer Secret (API Secret).

Make sure to allow your Twitter app to be used to Sign in with Twitter.

Head over to the Firebase console - Authentication ► Sign-In Method, and enable Twitter. Place in your API Key and API Secret.

Open config.xml at the root directory of the app, and add the following preferences before the closing tag:

<preference name="TwitterConsumerKey" value="8LrirB4nVIN2NJ8XFONfINs51" /> <preference name="TwitterConsumerSecret" value="**********************************************" />

twitter-connect-plugin requires a Fabric API Key from Twitter's Fabric SDK.

Head over to https://get.fabric.io/, sign-up or sign-in using your Fabric account.

While signed in on Fabric, visit https://fabric.io/kits/android/crashlytics/install, and look for your Fabric API Key in the metadata io.fabric.ApiKey in the AndroidManifest.xml.

Finally, we install the twitter-connect-plugin by calling the following command:

cordova plugin add twitter-connect-plugin --variable FABRIC_KEY=FABRIC_API_KEY npm install @ionic-native/twitter-connect --save

Now we have configured with success our Twitter Login and ready to use in your Ionic project.

In the next post we will show how to do Push Notifications with Ionic + Firebase! See you all soon.

See Also

fireIonic - Ionic 3 Firebase Starter Kit