Error: “com.facebook.sdk.login error 308” in Xamarin.Form

I am using Visual Studio 2017. I am trying to connect with Facebook using following code by not able to connect. Can any body please suggest me what I missing? I have tried many solution but none of them work.

public void LogInToFacebook()
{
    if (AccessToken.CurrentAccessToken == null)
    {
        ObtainNewToken(LogInToFacebook);
        return;
    }
}

Getting Error: The operation couldn’t be completed. (com.facebook.sdk.login error 308.)
private readonly string[] permissions = { "public_profile", "email", "user_birthday", "user_photos" };
private void ObtainNewToken(Action callback)
{
var login = new LoginManager();

        login.LogInWithReadPermissions(permissions, null, (r, e) =>
        {
            if (e == null && !r.IsCancelled)
                callback?.Invoke();
            else
                HandleError(e?.LocalizedDescription);
        });
    }

info.plist: Facebook Related content

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>myapp.com</key>
        <dict>
            <key>NSTemporaryExceptionMinimumTLSVersion</key>
            <string>TLSv1.0</string>
            <key>NSTemporaryExceptionRequiresForwardSecrecy</key>
            <false/>
            <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </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>
        <key>akamaihd.net</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
    </dict>
</dict>

<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>fbauth</string>
    <string>fbauth2</string>
    <string>fb-messenger-api20140430</string>
    <string>fb-messenger-api</string>
    <string>fbshareextension</string>
</array>
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb90000000000</string>
        </array>
        <key>CFBundleURLName</key>
        <string>facebook</string>
    </dict>
</array>
<key>FacebookAppID</key>
<string>8000666666666</string>
<key>FacebookDisplayName</key>
<string>MyApp – Test</string>

Best Answer

Answers

Sign In or Register to comment.