capacitor-community / facebook-login

Facebook Login support
MIT License
103 stars 52 forks source link

"Safari cannot open the page because the network connection was lost" on first login #85

Open nesro opened 2 years ago

nesro commented 2 years ago

Describe the bug When I run the login function, a web-view with "Log in With Facebook" is normally opened. There is the first login screen, i.e. "XYZ is requesting access to: Your name and profile picture and email address" and a button with "Continue as Tomas". When I click the button an error page with "Safari cannot open the page because the network connection was lost" is shown. If I refresh the page, there is another Facebook page with error "Something went wrong". If I cancel the login and try it again, it works fine since the login is already connected with my Facebook profile.

This first login scenario works fine in web application.

To Reproduce Steps to reproduce the behavior:

  1. Go to Facebook Log in Page
  2. Click on Continue as XYZ
  3. See error

Expected behavior It should return to the application.

Screenshots 0 1 2

Desktop (please complete the following information):

Smartphone (please complete the following information):

UPDATE

I found some errors in xcode log:

(this is probably ok) FBSDKLog: starting with Graph API v2.4, GET requests for /2641327169499829/aem_conversion_configs should contain an explicit "fields" parameter

2022-02-26 13:41:59.800760+0100 Windy[43573:16221031] -canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"

nw_protocol_instance_access_flow_state [C23.1.1:2] Failed to find flow 159111d88

ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, dns)] unregister notification for read_timeout failed

ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, dns)] unregister notification for keepalive failed

nw_endpoint_handler_set_adaptive_read_handler [C23.1.1 [IP address] ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, dns)] unregister notification for read_timeout failed

..

It might be an issue with LSApplicationQueriesSchemes. But I tried to Google the problem but nothing works for me.

UPDATE 2

I don't want to speak too soon, but I think I might have fixed the issue.

This is what your readme suggest to fill into LSApplicationQueriesSchemes.

    <string>fbapi</string>
    <string>fbapi20130214</string>
    <string>fbapi20130410</string>
    <string>fbapi20130702</string>
    <string>fbapi20131010</string>
    <string>fbapi20131219</string>
    <string>fbapi20140410</string>
    <string>fbapi20140116</string>
    <string>fbapi20150313</string>
    <string>fbapi20150629</string>
    <string>fbapi20160328</string>
    <string>fbauth</string>
    <string>fb-messenger-share-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>

I made it work by adding additional:

      <string>fb-messenger-api20140430</string>
      <string>fb-messenger-platform-20150128</string>
      <string>fb-messenger-platform-20150218</string>
      <string>fb-messenger-platform-20150305</string>

Permissions I am asking are 'public_profile', 'email', but it didn't work even when I tried different permissions before.

Either way, I am not closing this issue since whether I am doing something wrong, or the readme could be improved.

Thanks for this great plugin. Other than this issue, it's easy to work with.

UPDATE 3

I checked this with a colleague this morning and it worked for him. But - it opened the Facebook app to login with. In my case, only web-view was opened.

rdlabo commented 2 years ago

Thanks for issue.

Did you use FBSDKMessengerShareKit?? LoginSDK may not require: It is possible that the SDK is outdated, so you may want to try pod update it.

<string>fb-messenger-api20140430</string>
<string>fb-messenger-platform-20150128</string>
<string>fb-messenger-platform-20150218</string>
<string>fb-messenger-platform-20150305</string>

I checked this with a colleague this morning and it worked for him. But - it opened the Facebook app to login with. In my case, only web-view was opened.

I think this depends on whether you have the Facebook app on your device or not.