I read the documentation on https://www.firebase.com/docs/ios/guide/login/twitter.html. I downloaded and added the two files as it says in the documentation. I also imported Accounts at the beginning of the files, so Xcode builds successfully. Then I copied the exact code in the documentation to my twitterLogin IBAction, and set my Twitter API Key and Firebase base reference.
The problem is that when I click on my twitter login button, nothing happens. (It used to say no twitter accounts, then I set my account in the Settings.) I even put print statements in any if-else case but none of them prints. So is there any suggestions for making Twitter login work? I don’t think Firebase is missing anything. But please give some suggestions on how to figure out the issue at least.
3
Answers
I solved the issue. The 'funny' solution was to add an equal sign to the condition
For anyone who is not lucky enough to notice that the sample code in the Firebase documentation is weirdly working only for users that have 'more' than 1 twitter account signed in the device, I believe this answer would help to save some time.
I also think that this sample code is misleading.(may be something that shouldn't be the default case in the sample code)
Check to make sure that you have Enabled Twitter Authentication in your Firebase Dashboard, and that the apiKey in your project matches the one that is in your Dashboard.
Hope that helps 🙂
I have recently found some pretty good stuff on exactly this topic may it can help someone:
https://medium.com/reversebits/twitter-authentication-in-firebase-for-android-51d1460dc6a9#.strjpm90r