EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 445 forks source link

Facebook and Google login not working only on iOS #409

Open yorelbaker opened 7 years ago

yorelbaker commented 7 years ago

Hey,

I'm using Angular for my app, and Google and Facebook login works perfectly on Android, but on iOS I can't get redirected back to app to complete the login.

When I try to login through Facebook on the simulator, after the Confirm login page, it goes to a blank page. I get this error when trying to login: -canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"

On an actual device if I login through the popup it'll do the same thing, but if I login through my Facebook app, it'll just redirect back to the "login through app or enter name/pword" page in my app.

When logging in using Google, on both simulator and device, after I login (choose my account), it'll just go to google.com in the WebView.

I'm pretty sure my plist is correct. I've double checked the plist according to the demo and it looks correct. I've triple checked my settings on the firebase console and Facebook developer website.

Any help would be appreciated!

EddyVerbruggen commented 7 years ago

Please share your project and I'll take a look.

yorelbaker commented 7 years ago

Google Service json screen shot 2017-06-26 at 8 00 33 pm

UserService screen shot 2017-06-26 at 8 01 01 pm

Info.plist screen shot 2017-06-26 at 8 00 10 pm

Let me know if you need more.

EddyVerbruggen commented 7 years ago

Yes, I need something I can clone, run, and immediately see the problem. That's what I'm used to doing when reporting issues so maintainers can put their precious time in solving the issue rather than trying to reproduce them. Thanks!

yorelbaker commented 7 years ago

Makes sense. Here's a zip: Groceries.zip

It's just an extension of the Groceries tutorial.

Thanks for your help!

yorelbaker commented 7 years ago

Is that fine or do you want me to put it on Github?

Also here's a new .zip, I had updated to 4.0.2 but for someone reason it couldn't finish building on Android (but we don't have to worry about that), so I downgraded to what I had before. Also I changed my bundle identifier so I had to reflect that in the app.gradle . The logging in still works only on Android.

Groceries.zip

smarza commented 7 years ago

@yorelbaker @EddyVerbruggen I catch a similar issue here.

Facebook login works on Android and failed on IOS.

The error message catch by firebase.login was: login cancelled

Seems like the facebook page appears and even after accept the app permission, nothing happens. The errors occurs when the user closes the facebook login/password page.

"nativescript": {
    "id": "com.sortenasvendas.app",
    "tns-android": {
      "version": "3.0.1"
    },
    "tns-ios": {
      "version": "3.1.0"
    }
  },
  "dependencies": {
    "@angular/animations": "~4.1.0",
    "@angular/common": "~4.1.0",
    "@angular/compiler": "~4.1.0",
    "@angular/core": "~4.1.0",
    "@angular/forms": "~4.1.0",
    "@angular/http": "~4.1.0",
    "@angular/platform-browser": "~4.1.0",
    "@angular/router": "~4.1.0",
    "angular2-uuid": "^1.1.1",
    "nativescript-angular": "~3.0.0",
    "nativescript-appversion": "^1.4.1",
    "nativescript-audio": "^3.4.3",
    "nativescript-cardview": "^2.0.2",
    "nativescript-fabric": "^1.0.0",
    "nativescript-geolocation": "^3.0.0",
    "nativescript-loading-indicator": "^2.3.2",
    "nativescript-local-notifications": "^1.2.1",
    "nativescript-localstorage": "^1.1.5",
    "nativescript-plugin-firebase": "^3.12.0",
    "nativescript-pulltorefresh": "^2.0.1",
    "nativescript-ripple": "^2.0.0",
    "nativescript-social-share": "^1.3.2",
    "nativescript-telerik-ui": "^2.0.1",
    "nativescript-theme-core": "~1.0.2",
    "nativescript-toast": "^1.4.5",
    "nativescript-zip": "^1.3.2",
    "ngx-pipes": "^1.6.1",
    "reflect-metadata": "~0.1.8",
    "rxjs": "~5.3.0",
    "tns-core-modules": "~3.0.1",
    "zone.js": "~0.8.2"
  },
  "devDependencies": {
    "@angular/compiler-cli": "^4.1.3",
    "@ngtools/webpack": "^1.4.1",
    "babel-traverse": "6.4.5",
    "babel-types": "6.4.5",
    "babylon": "6.4.5",
    "copy-webpack-plugin": "^4.0.1",
    "extract-text-webpack-plugin": "^2.1.2",
    "lazy": "1.0.11",
    "nativescript-css-loader": "^0.26.1",
    "nativescript-dev-typescript": "~0.4.0",
    "nativescript-dev-webpack": "^0.6.3",
    "raw-loader": "^0.5.1",
    "resolve-url-loader": "^2.0.3",
    "typescript": "~2.3.4",
    "webpack": "^3.0.0",
    "webpack-sources": "^1.0.1"
  },

Any ideias? Thanks

yorelbaker commented 7 years ago

@EddyVerbruggen, any progress on the issue?

EddyVerbruggen commented 7 years ago

No time yet.

randy-johnson commented 7 years ago

I am experiencing the same thing as the original poster. Logs into fb and google just fine on IOS, but afterwards I get the blank browser screen and then the fbauth2 error.

yorelbaker commented 7 years ago

@EddyVerbruggen any progress on this?

slushnys commented 7 years ago

After some investigation I found out that its because the app is using simulator to be ran. When logging in it tries to open native Facebook application on your simulator which it cannot.

iOS SDK supports SafariViewController which lets us switch show web-rendered dialogs instead of doing an app-switch. This beta SDK will automatically determine the best app switch experience for people based on their device. For example, defaulting the person's experience through SafariViewController instead of Safari for Facebook Login....

Not really sure how to solve this. Maybe a workaround on the LoginSDK is required? There's an explanation of sorts here

kvindascr commented 7 years ago

+1 Im also facing this issue

kvindascr commented 7 years ago

Hello Guys, I think I have found the cause of the issue, at least for my project. Im not sure how to fix it yet. In our project we are using OneSignal Push Notifications, which as a side effect force us to define an application delegate in IOS. Firebase under the hood requires to define an application delegate for facebook, and I think there is conflicts between both delegates. Once I remove my project delegate it starts working properly.

sitefinitysteve commented 6 years ago

I just hit this as well... 99% if ios users are fine, but seems iOS 10 doesn't send to login, but just to Google.com.

Had the user update his iPhone 7 to ios11, hrs working fine.

So that's a fix for us, but not a great one as the other user with the problem has an iPhone 5s, and ios11 would murder that thing.

sitefinitysteve commented 6 years ago

I can reproduce this right now on iOS10.3 in my app with the latest 4.2

I have a video, it's like it just like google gives up or something :) https://www.screencast.com/t/sxIHnKMtH

This sample issue seems to the same problem we're seeing https://github.com/googlesamples/google-services/issues/162

EddyVerbruggen commented 6 years ago

@sitefinitysteve Do you have the relevant CFBundleURLTypes configured in your /App_resources/iOS/Info.plist? Those are used to redirect back to your app once OAuth finishes.

sitefinitysteve commented 6 years ago

Hey eddy, this is just for users on iOS 10, it's solid on 11... it's been our go-to fix, but some users (students) are not wanting to slow down their devices (5&6) with iOS11 👎 I've been debugging it all day.

One thing I have noticed (what I'm currently looking into) is that there is this error in the console https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/457 Whereas on iOS11 it doesn't exist... says enabled and goes on it's merry way.

Is there some way to dump console messages for the appdelegate code, how do I debug those guys to see whats going on. Nothing I put inside there gets put into the console.

EddyVerbruggen commented 6 years ago

Argh yeah, those are hard.. I've had to resort to console logging mostly. I don't have an iOS 10 device, but perhaps iOS 9 has a similar issue.. let me check.

EddyVerbruggen commented 6 years ago

Yep, iOS 9 is all good (auto-redicted to the app after Google sign in):

image1

I'd update it to iOS 10 if I could but not sure if that's even possible.

sitefinitysteve commented 6 years ago

I could only get to it by installing the 10.3 sim into xcode...

On Nov 27, 2017 3:30 PM, "Eddy Verbruggen" notifications@github.com wrote:

Yep, iOS 9 is all good:

[image: image1] https://user-images.githubusercontent.com/1426370/33287729-eeced726-d3b9-11e7-89c6-a0da18e4d083.PNG

I'd update it to iOS 10 if I could but not sure if that's even possible.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/409#issuecomment-347318066, or mute the thread https://github.com/notifications/unsubscribe-auth/ABeI6Gxw3IjxUdcHhGmbPaeJKdXNrYpNks5s6xvkgaJpZM4OEzyA .

EddyVerbruggen commented 6 years ago

Let me do that as well. May take a day :)

sitefinitysteve commented 6 years ago

I'm still trying to isolate as well... Just got pulled away for the aft :/

On Nov 27, 2017 3:48 PM, "Eddy Verbruggen" notifications@github.com wrote:

Let me do that as well. May take a day :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/409#issuecomment-347322609, or mute the thread https://github.com/notifications/unsubscribe-auth/ABeI6JsC2iYAFSrlS0wkUyA6wIkUeZ3xks5s6x_JgaJpZM4OEzyA .

EddyVerbruggen commented 6 years ago

This is the embedded demo app running on an iPhone 7 sim (10.3.1):

kapture 2017-11-27 at 22 05 07

sitefinitysteve commented 6 years ago

@EddyVerbruggen Yeah man, I just pulled down the repo and this works for me as well... I guess I'm digging for differences, maybe plugin conflict or something I don't really know atm.

sitefinitysteve commented 6 years ago

Man, I'm not sure what's left to change...

plists are correct, using a local version of the plugin (from the demo, so code is identical), hosted domain doesn't matter, using the same user in both, same login code, same NS versions.

Gonna try adding the plugin to a blank project and go from there next

sitefinitysteve commented 6 years ago

Is this node by any chance for facebook?

https://github.com/EddyVerbruggen/nativescript-plugin-firebase/blob/master/demo/app/App_Resources/iOS/Info.plist#L68-L77

...again just looking for differences

EddyVerbruggen commented 6 years ago

Yes (judging from the fb prefix - a URL scheme can't be numeric, that's why they use that).

sitefinitysteve commented 6 years ago

Yeah, grabbing at straws at this point, thx for pushing out v5 though btw, helps me out not needing a local copy

On Tue, Nov 28, 2017 at 1:40 PM, Eddy Verbruggen notifications@github.com wrote:

Yes (judging from the fb prefix - a URL scheme can't be numeric, that's why they use that).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/409#issuecomment-347622159, or mute the thread https://github.com/notifications/unsubscribe-auth/ABeI6MH1SvhJxoR5KxVwN07Nijo3MbZ6ks5s7FONgaJpZM4OEzyA .

sitefinitysteve commented 6 years ago

Okay with debugging enabled, I get this on iOS10 (on that iPhone7), but nothing of the sort on the WORKING iOS11 sim

Nov 28 14:12:58  macdot[37894] <Debug>: [Firebase/Analytics][I-ACS023001] Deep Link does not contain valid required params. URL params: {
        code = "4/N6jopitSUFFsjHH9yFW2SZfIINifL0TnTi5z_dDlLnc";
    }

I FEEL like what's happening is that it's seeing it as a Deep link (when it's not) and then tanking

EddyVerbruggen commented 6 years ago

Makes a lot of sense..

Do you have invites and/or dynamic links enabled?

Also, I never like url params that contain slashes. I've seen so many requests randomly fail because of an unencoded slash. But I guess that's not the problem, otherwise it would have been reported and fixed in the Firebase iOS SDK a long time ago.

sitefinitysteve commented 6 years ago

It does logically, but I am just stumped as to why or how or... bloody anything at this point. I posted to the firebase group to see if someone knows...

I have no deep links set, I even commented out like all deeplink code in the .js for the plugin too. 😞

It's happening on both our apps here, so there's some common config or thing somewhere, maybe in the backend or... I don't even know.

99% sure this is the problem though, the demo app doesn't throw that error, and the error happens right before it doesn't send the user back to the app.

EddyVerbruggen commented 6 years ago

I'll see if I can update my iPhone 5s to iOS 10 (it's on 9 now) somehow. UPDATE: yep, this should work.

Can I run your app on it?

sitefinitysteve commented 6 years ago

I can't see that mattering tbh, like you showed the demo, the demo works on 10, works for me too, but our 2 apps fail with the error.

On Nov 28, 2017 3:00 PM, "Eddy Verbruggen" notifications@github.com wrote:

I'll see if I can update my iPhone 5s to iOS 10 (it's on 9 now) somehow.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/409#issuecomment-347645757, or mute the thread https://github.com/notifications/unsubscribe-auth/ABeI6D3hMt4-3G5fwCDhDPchQ8u9WqQ-ks5s7GZQgaJpZM4OEzyA .

EddyVerbruggen commented 6 years ago

Yeah but your apps only error on iOS 10, right? I'd be happy to try your app on my soon-to-be-ios-10-iPhone5s.

sitefinitysteve commented 6 years ago

I would bloody love a sanity check on it because i have spent 2 solid days comparing the 2 projects.

I do know it will tank on a physical device and sim, have about 10 sol users in the wild right now. :) The plan was to get everyone logging in mobile app so we don't have to do a webapp version, but these ios10 stragglers have kinda forced the hand to go build the web version. Kinda needed to happen ANYWAY imo so this is a blessing in disguise.

Its GOTTA be a backend config somewhere, the plist has nothing special, and I've added all the same plugins from my app into the demo and it's still fine.

On Nov 28, 2017 3:12 PM, "Eddy Verbruggen" notifications@github.com wrote:

Yeah but your apps only error on iOS 10, right? I'd be happy to try your app on my soon-to-be-ios-10-iPhone5s.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/409#issuecomment-347649164, or mute the thread https://github.com/notifications/unsubscribe-auth/ABeI6EmbqqGMJTcHVB4oki4L3tqvhCRYks5s7Gk9gaJpZM4OEzyA .

sitefinitysteve commented 6 years ago

...Im in near tears right now I think I found the culprit :)

nativescript-store-update

It's init code in the app.ts somehow breaks the iOS callback. If I move that code from app.ts into the landing screen of the app, she's back in business.

yorelbaker commented 6 years ago

I'm crying. I'll try this later tonight!

Update: Actually I don't even think I have the nativescript-store-update plugin. I'll check the app.ts though to see if there's something else that might be causing it.

EddyVerbruggen commented 6 years ago

Spot on, @sitefinitysteve - I've answered in the nativescript-store-update repo.

PraktikerNeosoft commented 6 years ago

@kvindasAB Hi! Can you fixed Onesignal and facebook login delegate conflict? I have this problem too and i have no ide how fixed. When I remove onesignal delegate works fine. Thnx Miklos

kvindascr commented 6 years ago

Hello @PraktikerNeosoft, I have not dived myself into this plugin code, nor I have the time at this very specific moment to fix it. But basically in my code I was creating a new delegate, which was overriding the plugin one. The way to fix it in code was to ask either if the delegate was already there, in which case I make a function to extend the existing functionality. I can give you a sample of my code if that works for you. Im assuming that by facebook you, you are using this firebase plugin, and not another plugin, because my solution works with this plugin and one signal, but have not tried it out with other plugins. Let me know.

PraktikerNeosoft commented 6 years ago

@kvindasAB Huh. Plese send me code. It is help me how work for you. Please send miklos@neosoft.hu email. very very very thanxx