Facebook login shows an additional confirmation popup on iOS 11

facebook login behavior ios
facebook login swiftui
facebook for ios
login button facebook swift
facebook login android
login through facebook
login with facebook button
login with facebook code

I have implemented login through facebook using facebook SDK for swift. It works as expected on iOS 10.3, but on iOS 11 it shows and additional popup that asks the user to allow sign in through facebook.com.

This adds one more step in the login process that slows down the login process. Is there a way how to to configure the app to allow this by default, thus remove the annoying popup?

I am using facebook-sdk-swift 0.2.0 (FBSDK version is 4.26.0) added through cocoa pods.

Configuration in info.plist:

<key>FacebookAppID</key>
<string>xxxxxxxxxxxxxxx</string>
<key>FacebookDisplayName</key>
<string>XXXXX</string>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fbapi</string>
    <string>fb-messenger-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSExceptionDomains</key>
    <dict>
        <key>akamaihd.net</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>facebook.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>fbcdn.net</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
    </dict>
</dict>
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>facebook</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fbxxxxxxxxxxxxxxx</string>
        </array>
    </dict>
</array>

Code in AppDelegate:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    return SDKApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
}

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
    return SDKApplicationDelegate.shared.application(app, open: url, options: options)
}

LoginController has a custom login button with this in handler:

    let loginManager = LoginManager()
    loginManager.loginBehavior = .native
    loginManager.logIn([ .publicProfile, .userFriends, .email, .custom("user_location"), .custom("user_education_history"), .custom("user_work_history") ], viewController: self) { loginResult in
    }

I created an app from scratch to test it, shared on GitHub. Still does the same.

OK, so after several useless experiments I have been able to find a way to achieve what my client wanted. Aforementioned behavior is the result of a newer version of FBSDK. Once I downgraded from FBSDK 4.26.0 to 4.24.0 (Swift SDK version does not matter), the popup stopped showing. So if you are facing the same problem, and your clients (or you) don't want this popup, this might be a solution for you too.

I don't think facebook guys did this by accident, and this popup can allow some new iOS 11 feature. However, I was not able to distinguish any real new functionality - I only noticed that the newer version does not give you a choice if you want to login using native app or safari, but goes directly for the safari login. But since that was a requirement by my client as well, for me the choice was quite natural.

The message is a standard message used by SFAuthenticationSession to ask the user for permissions to access safari (excerpt from docs):

If an application uses SFAuthenticationSession, users are prompted by a dialog to give explicit consent, allowing the application to access the website's data in Safari.

UPDATE:

Apparently, Safari uses the "CFBundleName" property as the display name for this dialog. This is usually set to ${PRODUCT_NAME} which equals the last portion of your app's bundle identifier, but you can change it to whatever you like. Of course it is advisable to set it to the actual display name of your app.

It's not an issue. It's by design. Part of the authorization workflow when working with SFAuthenticationSession in iOS 11+ and you can't avoid it  I have implemented login through facebook using facebook SDK for swift. It works as expected on iOS 10.3, but on iOS 11 it shows and additional popup that asks the user to allow sign in through facebook.com.

This is related to the iOS 11.x update, Facebook SDK 0.3.0 is using SFAuthenticationSession which result in an Alert to give explicit consent, allowing the application to access the website's data in Safari.

Tried this on iOS 10.x, no Alert!

If you want to get rid of the popup, you should downgrade the Facebook SDK to 0.2.0 , and since the Facebook swift SDK still depends on the Objective C SDK you should force downgrading these ones as well to the version 4.22.1

Before Downgrade:

pod 'FacebookCore', '~> 0.3.0'
pod 'FacebookLogin', '~> 0.3.0'
pod 'FacebookShare', '~> 0.3.0'

After Downgrade:

pod 'FacebookCore', '~> 0.2.0'
pod 'FacebookLogin', '~> 0.2.0'
pod 'FacebookShare', '~> 0.2.0'
pod 'FBSDKCoreKit', '~> 4.22.1'
pod 'FBSDKLoginKit', '~> 4.22.1'
pod 'FBSDKShareKit', '~> 4.22.1'

I have implemented login through facebook using facebook SDK for swift. It works as expected on iOS 10.3, but on iOS 11 it shows and additional popup that  How to Sync Facebook Events to iPhone Calendar. The Apple Company has made a few changes to their iOS 11 that also prevents your calendar from synchronizing.The good news is there is a way to sync Facebook events to iPhone calendar in iOS 11 and continue using the iOS calendar as per your preferences.

I'm using FacebookLogin 0.5.0

Changing the Product Name under the target's Build Settings to the desired text worked.

Also, on my plist Bundle display name and Bundle name have $(PRODUCT_NAME)

Hello, I'm using facebook login in my app and when I click the "continue /​facebook-login-shows-an-additional-confirmation-popup-on-ios-11. Create an account or log into Facebook. Connect with friends, family and other people you know. Share photos and videos, send messages and get updates.

The following steps are for adding Facebook Login to your iOS project. In the dialog that appears, enter the repository URL: This avoids unnecessary showing the login flow again if someone already granted To request additional read permissions, set the readPermissions property on the FBSDKLoginButton object. Re-Authentication. Re-authentication enables your app to confirm a person's identity even if it was verified previously. Facebook Login lets your app ask a person to re-enter their Facebook password at any time. You can use this to prevent cases where a user leaves a device logged in or where a third-party hijacks someone's session with your app.

A subtle change to system settings in Apple's upcoming iOS 11 release, in San Jose, means it could become much more annoying to log into. apps use either Facebook or Twitter as the backbone of their login system, this  iOS 11. 1,620 likes · 1 talking about this. Coming to you in 2017 Please be sure to like this page for all the updates. Apple WWDC 2017 is in March

Go to https://developers.facebook.com/ and add your app from 'My App' button top dependencies into your app via Cocoapods just like you do for any other libraries. You will need 'OAuth redirect URI' located at the bottom of the pop-up. Click the 'Set up' button on the 'Facebook Login' thumbnail. Log into Facebook to start sharing and connecting with your friends, family, and people you know.

Comments
  • I use facebook sdk via pod file too in ios 11 but i didn't faced any kind of problem could you share how can you integrate your facebook login ?
  • exactly it re-directed automatically
  • I think problem is in you plist file. developers.facebook.com/docs/ios/getting-started maybe you can check this link and the inspect plist configuration
  • well, I am not able to see anything that I would miss.. and the login is otherwise working.. it seems just like some security tweak, although I don't understand why it works for you (and some other apps), but not in my case.. maybe it is a problem of the SDK version?
  • i use these pod 'FBSDKLoginKit' maybe the version of your pod is the issue
  • Hey, do you think we can change the message in this alert somehow?
  • its okay to show this popup but I want to know that how to edit app name? it seems that app name is not a nickname of app but a bundle name so its confusing
  • @Jigar you'll need to change the Product Name in your App Build Settings under the packaging section.
  • @vignesh that is not accurate, my product name is different from what appears there, it still shows the bundle id
  • @GustavoParrado I found a solution in the meantime. Apparently Safari uses the "CFBundleName" property as the display name for this dialog. This is usually set to ${PRODUCT_NAME}, which is the internal identifier. I fixed my problem by changing it to the display name of my app and it works perfectly. FFR: github.com/facebook/facebook-swift-sdk/issues/…