capacitor-community / facebook-login

Facebook Login support
MIT License
103 stars 52 forks source link

fbapi:/" - error: "The operation couldn’t be completed. #74

Open kingkarki opened 2 years ago

kingkarki commented 2 years ago

I m getting the following error after clicking the login with the Facebook button.

⚡️ To Native -> FacebookLogin login 105769730 2022-01-05 13:26:43.944227+0545 App[10381:134209] -canOpenURL: failed for URL: "fbapi:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)" 2022-01-05 13:26:43.997611+0545 App[10381:134908] [AXRuntimeCommon] Unknown client: App

My code


async fbNativeLogin() {
    const FACEBOOK_PERMISSIONS = ['public_profile', 'email'];
    const result = await this.fbPlugin.login({ permissions: FACEBOOK_PERMISSIONS });

    if (result.accessToken) {
      // Login successful.
      console.log(`Facebook access token is ${result.accessToken.token}`);
    }
  }

Node modules "@angular-devkit/core": "^13.1.2", "@angular-devkit/schematics": "^13.1.2", "@angular/common": "~13.1.1", "@angular/core": "~13.1.1", "@angular/forms": "~13.1.1", "@angular/platform-browser": "~13.1.1", "@angular/platform-browser-dynamic": "~13.1.1", "@angular/router": "~13.1.1", "@angular/service-worker": "~13.1.1", "@awesome-cordova-plugins/core": "^5.37.3", "@awesome-cordova-plugins/sign-in-with-apple": "^5.37.3", "@capacitor-community/apple-sign-in": "^1.0.1", "@capacitor-community/facebook-login": "^3.1.1", "@capacitor/android": "3.3.3", "@capacitor/app": "1.0.6", "@capacitor/core": "^3.3.3",

rdlabo commented 2 years ago

I checked it, but it seems to work normally. Please try v3.2.0.

kingkarki commented 2 years ago

I have the following plugins installed from Cordova and Capacitor

@ionic-enterprise/auth@3.9.2 [capacitor] @ionic-enterprise/identity-vault@5.3.1 [capacitor] @ionic-enterprise/secure-storage@2.2.1 [capacitor] cordova-plugin-facebook-connect@3.2.0 [capacitor] cordova-plugin-sign-in-with-apple@0.1.2 [capacitor] ✔ copy ios in 933.57ms [capacitor] ✔ Updating iOS plugins in 18.55ms [capacitor] [info] Found 5 Capacitor plugins for ios: [capacitor] @capacitor/app@1.0.6 [capacitor] @capacitor/haptics@1.1.3 [capacitor] @capacitor/keyboard@1.1.3 [capacitor] @capacitor/status-bar@1.0.6 [capacitor] capacitor-apple-pay@0.2.1 [capacitor] [info] Found 5 Cordova plugins for ios: [capacitor] @ionic-enterprise/auth@3.9.2 [capacitor] @ionic-enterprise/identity-vault@5.3.1 [capacitor] @ionic-enterprise/secure-storage@2.2.1 [capacitor] cordova-plugin-facebook-connect@3.2.0 [capacitor] cordova-plugin-sign-in-with-apple@0.1.2

@rdlabo do you think is there any conflict with these plugins?

I have also uploaded video with issue please check here

https://youtu.be/JsK_IMk3EOo

Thanks, krishna

rdlabo commented 2 years ago

Saw youtube, this may not be plugin error.

Do you use current version of iOS and Xcode?

kingkarki commented 2 years ago

I tested on Xcode 12.4 and 13.2.1 with ios 13 and 14 the same error on all versions.

rdlabo commented 2 years ago

Did you add data to info.plist?

https://github.com/capacitor-community/facebook-login#ios-configuration

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb[APP_ID]</string>
        </array>
    </dict>
</array>
<key>FacebookAppID</key>
<string>[APP_ID]</string>
<key>FacebookClientToken</key>
<string>[CLIENT_TOKEN]</string>
<key>FacebookDisplayName</key>
<string>[APP_NAME]</string>
<key>LSApplicationQueriesSchemes</key>
<array>
    <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>
</array>
kingkarki commented 2 years ago

Yes this is my full info.plist file


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDisplayName</key>
    <string>Little Star</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>fbapp_id</string>
            </array>
        </dict>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>littlestar</string>
            </array>
        </dict>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>com.googleusercontent.apps.xxxx</string>
            </array>
        </dict>
    </array>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>FacebookAppID</key>
    <string>app_id</string>
    <key>FacebookClientToken</key>
    <string>app_token</string>
    <key>FacebookDisplayName</key>
    <string>Nebulaeapp Little Star</string>
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <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>
    </array>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>
    <key>NSCameraUsageDescription</key>
    <string>Use for barcode scan</string>
    <key>NSFaceIDUsageDescription</key>
    <string>use for biometric login</string>
    <key>NSPhotoLibraryAddUsageDescription</key>
    <string>Get Library Photos</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>Photo Upload</string>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <true/>
</dict>
</plist>

I am using a real app id and app token in my code.

rdlabo commented 2 years ago

@kingkarki CFBundleURLSchemes may be wrong. Your settings is overwrited.

        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>fbapp_id</string>
                <string>littlestar</string>
                <string>com.googleusercontent.apps.1034936433195-bihnegoa3n2dg20nm5nodl7s5s0h7tth</string>
            </array>
        </dict>
kingkarki commented 2 years ago

@rdlabo have the same error after removing google login plist I removed this

<dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>com.googleusercontent.apps.1034936433195-bihnegoa3n2dg20nm5nodl7s5s0h7tth</string>
            </array>
        </dict>

now it looks like this

<key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>fbxxx</string>
            </array>
        </dict>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>littlestar</string>
            </array>
        </dict>

    </array>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>FacebookAppID</key>
    <string>1280227665793559</string>
    <key>FacebookClientToken</key>
    <string>xxx</string>
    <key>FacebookDisplayName</key>
    <string>Nebulaeapp Little Star</string>
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <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>
    </array>
rdlabo commented 2 years ago
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>littlestar</string>
        </array>
    </dict>

is overwrited.

kingkarki commented 2 years ago

I removed that block and still the same issue 🤔

kingkarki commented 2 years ago

Here the full log

[log] - status {"status":"unknown"}
To Native Cordova ->  FacebookConnectPlugin login FacebookConnectPlugin324511747 ["options": [email, public_profile]]
2022-01-17 16:24:36.176769+0545 App[16038:210457] Starting login
2022-01-17 16:24:36.186236+0545 App[16038:210457] -canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
2022-01-17 16:24:36.256483+0545 App[16038:210666] [AXRuntimeCommon] Unknown client: App
rdlabo commented 2 years ago

Please search on google before ask: https://stackoverflow.com/questions/32663382/facebook-login-issue-canopenurl-failed-for-url-fbauth2-error-null

And this error is from FacebookConnectPlugin. cordova-plugin-facebook-connect is not this plugin issue.

patsybond172 commented 1 year ago

it seems to work normally. Please try v3.2.0 in here https://patsybond172.github.io/kitchen-cabinets or here https://github.com/patsybond172