parse-community / Parse-SDK-Android

The Android SDK for Parse Platform
https://parseplatform.org/
Other
1.88k stars 739 forks source link

Facebook login fails logging in to Facebook from an embedded browser #1164

Closed EAncis closed 2 years ago

EAncis commented 2 years ago

New Issue Checklist

Issue Description

I am part of the [removed] developer team, one of our apps is [removed]. Our Apps (iOS/Androd) include the authentication throughout the Facebook account that has always workred on each platform.

Now we have been contacted by the Facebook team beacuse a persiting issue on this feature douring these last mounths on Android.

We have updates the Facebook SDK and your Parse-SDK-Android, che cked our existing implemetantion about the login flow from the developer Facebook documentation and the your Parse Facebook Utils for Android.

Everything appears correct, but the issue persists.

Maybe Parse Facebook Utils for Android need to be update after any Facebook SDK Change? Anyway can you help us to fix our issue?

Steps to reproduce

Actual Outcome

Facebook login error view with For your account security, logging in to Facebook from an embedded browser is disabled. You may be able to continue by updating the app you're logging in from and trying again message.

Expected Outcome

Proceed to login on the [removed] app and access the its homeview

Environment

Developing on Android Studio Bumblebee 2021.1.1 Patch 3, Java Language, Gradle 7.2 and Gradle plugin 7.1.3 Tested on Android 10 (physical device) and 12 (emulated device) Dependencies: com.facebook.android:facebook-android-sdk:13.1.0: com.facebook.android:facebook-login:13.1.0 com.github.parse-community.Parse-SDK-Android:parse:3.0.0 com.github.parse-community.Parse-SDK-Android:google:3.0.0 com.github.parse-community.Parse-SDK-Android:facebook:3.0.0 com.github.parse-community.Parse-SDK-Android:fcm:3.0.0 com.github.parse-community.Parse-SDK-Android:ktx:3.0.0 com.github.parse-community.Parse-SDK-Android:coroutines:3.0.0

Parse Android SDK

Server

Database

Logs

Any long is retrived into theLogcat. On debugging mode we can check that after the FB Button onclick the flow passes into

ParseFacebookUtils.logInWithReadPermissionsInBackground(...)

then throught the

 @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
  ParseFacebookUtils.onActivityResult(requestCode, resultCode, data);
} 

but does not return from the callback into any case of

@Override
  public void done(ParseUser user, ParseException err) {
    if (user == null) {
      Log.d("MyApp", "Uh oh. The user cancelled the Facebook login.");
      ...
    } else if (user.isNew()) {
      Log.d("MyApp", "User signed up and logged in through Facebook!");
      ...
    } else {
      Log.d("MyApp", "User logged in through Facebook!");
      ...
    }
  }
parse-github-assistant[bot] commented 2 years ago

Thanks for opening this issue!

mtrezza commented 2 years ago

Facebook login error view with For your account security, logging in to Facebook from an embedded browser is disabled. You may be able to continue by updating the app you're logging in from and trying again message.

See https://developers.facebook.com/blog/post/2021/06/28/deprecating-support-fb-login-authentication-android-embedded-browsers/

Maybe there is something we need to change in the Parse Android SDK? In my understanding, upgrading to the newest FB SDK should fix the issue.

azlekov commented 2 years ago

@mtrezza thanks for the link. Deprecating webviews page gives nice guide what to do in order to overcome the deprecation.

In my understanding, upgrading to the newest FB SDK should fix the issue.

Here we use version v12 of the SDK which will be bumped to latest v13 in https://github.com/parse-community/Parse-SDK-Android/pull/1163

@EAncis when login what happens - a web view appear to login or the Facebook app is opened? Will be strange if web view login is triggered when you have installed Facebook on the phone. Can you confirm that login is not working also without Facebook app?

azlekov commented 2 years ago

From Deprecating webviews it looks that the app should have configured CustomTabs something I think is not part of the Parse Facebook module right now.

@EAncis may you please follow these steps in the Deprecating webviews and tell us the outcome:

EAncis commented 2 years ago

@mtrezza thanks for the link. Deprecating webviews page gives nice guide what to do in order to overcome the deprecation.

In my understanding, upgrading to the newest FB SDK should fix the issue.

Here we use version v12 of the SDK which will be bumped to latest v13 in #1163

@EAncis when login what happens - a web view appear to login or the Facebook app is opened? Will be strange if web view login is triggered when you have installed Facebook on the phone. Can you confirm that login is not working also without Facebook app?

Hi @mtrezza, sorry for the delay in my reply, I describe 3 use cases: 1) With Facebook app logged: user clicks on Facebook login button, somethings happens (a quick loader and a quick view appears) but my app does not proceed.

2) With Facebook app not logged: user clicks on Facebook login button, it's opened the Facebook app, user select his account, it's tried the login flow, the it's shown this error view inside my app Screenshot_20220511-150146

3) Without facebook app: user clicks on Facebook login button, it's opened the chorme embedded broswer with the same message error Screenshot_20220511-151729

EAncis commented 2 years ago

In addition to what just written to @mtrezza a strange behavior that I have observed is that the login is successful only with the developer facebook account credentials

azlekov commented 2 years ago

@EAncis did you try with older version of the Parse SDK for Android?

It will be important to know if it's failing with an older version. This will hint whenever this is issue in the SDK or misconfiguration in your app.

EAncis commented 2 years ago

with this configuration the FB login was still working at the beginning of the year, then stops

Gradle 4.1.1 Android API 31

dependences: Parse SDK 1.23.1 facebook-login 5.15.3 Parse SDK 1.23.1 facebook-android-sdk:4.42.0

Then I tried with this update:

Gradle 7.1.3 Parse SDK 3.0.0 facebook-login 13.1.0 facebook-android-sdk 13.1.0

but the issues is not fixed

azlekov commented 2 years ago

And you did check if there are required adjustments to configure your app to the newer Facebook SDK?

Jumping from:

facebook-login 5.15.3 -> facebook-login 13.1.0\ facebook-android-sdk:4.42.0 -> facebook-android-sdk 13.1.0

Is big leap...

When I update the Facebook SDK and the Facebook module on the Parse SDK for Android I did check for some breaking changes regarding the SDK itself and the way the code is organized, implemented etc and did not find anything.