Open zuohuadong opened 6 years ago
That would be great. PR's more than welcome!
@EddyVerbruggen First off thanks for your work on this plugin! I'm currently using it on a project and was wanting to create a PR for twitter login. If you could point me in the right direction and give me some pointers it would much appreciated... I'm new to this whole plugin thing and wanting to dive into it. Thanks!
@brownkevg Awesome, your help is much appreciated!
I was typing a lengthy instruction for how to go about this, but then I found this and this.
So the way Firebase is currently integrating with Twitter is deprecated and will change. It would be a bit silly to start working on this now I'm afraid. But if you really need it, I won't stop you doing a bit of work that will need to be refactored in a few months. So here goes anyway:
So to add Twitter support, let me tell you what my steps would roughly be:
cd src
and run npm run setupandinstall
(just skip through the plugin y/n prompts you'll get as those are ignored in this case). Then see if the demo app runs: npm run demo.ios
(or .android
).TwitterKit
SDK, you'll have to change publish/scripts/installer.js
. Make it ask the user during installation whether or not Twitter auth is used and add the required TwitterKit
Pod accordingly. After running the demo app again it's really helpful to have code completion when working with this new SDK, so run this npm script and copy over the generated objc!TwitterKit.d.ts
file to this folder and reference it in this fileTWITTER
to the enum of supported auth providers.Yah, sounds like it'll be worth it to wait until they come out with the new way of logging in. Let me know if you hear when that happens. I'll also try to look out for that as well. Also thanks for the instructions, I may try playing around with it just to get my feet wet.
Any updates on this? Is there a new way of logging in that can be implemented in this plugin? Thanks!
Safe to assume no updates yet?
@ScottAtRedHawk @goyote
We use Ioinic now.
We used a fork of the nativescript-twitter plugin and just handle it outside of firebase.
+1 Maybe?
@EddyVerbruggen still no update for this?
@Lavhe not from me, but if you feel like taking a stab at it, then please take not of my PR hints above.
I am working on it now, it looks fun, problem is i do not have a mac, so i will test for android only
I did it finally
:partying_face: :partying_face: :partying_face:
Just that it is for android only, who here can port this to IOS?
Hi @EddyVerbruggen
Must i open a PR with just android support? or you need IOS as well?
@Lavhe As long as it's very clear from the readme, and the app doesn't crash on iOS, then I don't mind supporting only Android for the time being.
I used OAuth for twitter login. I patched firebase.ios.js like this to make app can handle oauth callback with applicationOpenURLOptions.
appDelegate.prototype.applicationOpenURLOptions = function (application, url, options) {
+ if (typeof FIRAuth !== "undefined") {
+ return FIRAuth.auth().canHandleURL(open);
+ }
And use OAuth sign-in
const provider = FIROAuthProvider.providerWithProviderID("twitter.com");
const UIDelegate = null as unknown as FIRAuthUIDelegate;
FIRAuth.auth().signInWithProviderUIDelegateCompletion(provider, UIDelegate, (authResult, error): void => {
// if authResult then firebase.getCurrentUser() returns logged-in user.
});
In addition, Android worked fine without any patch.
support twitter ?