darwin-morocho / flutter-facebook-auth

A flutter plugin to add login with facebook in your flutter app
193 stars 127 forks source link

Facebook Login not working on real device #162

Closed shahid31346 closed 2 years ago

shahid31346 commented 2 years ago

Facebook login is working on android emulator but it is not working in real device showing the following in that function hit

Running with unsound null safety For more information see https://dart.dev/null-safety/unsound-null-safety E/ (26513): [ZeroHung]zrhung_get_config: Get config failed for wp[0x0008] D/AwareBitmapCacher(26513): handleInit switch not opened pid=26513 D/ZrHung.AppEyeUiProbe(26513): notify runnable to start. D/ZrHung.AppEyeUiProbe(26513): restart watching I/OpenGLRenderer(26513): Initialized EGL, version 1.4, mEglDisplay 0x1 D/OpenGLRenderer(26513): Swap behavior 2 D/mali_winsys(26513): EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface , EGLBoolean) returns 0x3000 D/mali_winsys(26513): EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface , EGLBoolean) returns 0x3000 W/libEGL (26513): EGLNativeWindowType 0x7d6f997010 disconnect failed D/mali_winsys(26513): EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface , EGLBoolean) returns 0x3000 I/ViewRootImpl(26513): jank_removeInvalidNode jank list is null W/InputMethodManager(26513): startInputReason = 1 W/InputMethodManager(26513): startInputReason = 5 V/AudioManager(26513): playSoundEffect effectType: 0 V/AudioManager(26513): querySoundEffectsEnabled... I/flutter (26513): Erro! nnnnn D/ZrHung.AppEyeUiProbe(26513): stop checker. W/ActivityThread(26513): handleWindowVisibility: no activity for token android.os.BinderProxy@c1a388c D/ZrHung.AppEyeUiProbe(26513): notify runnable to start. V/ActivityThread(26513): Skipping new config:{1.0 410mcc4mnc [en_US] ldltr sw360dp w360dp h686dp 480dpi nrml long port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 0, 0) mAppBounds=Rect(0, 90 - 1080, 2150) mWindowingMode=fullscreen mActivityType=undefined} nonFullScreen=0 suim:4 s.48}, config:{1.0 410mcc4mnc [en_US] ldltr sw360dp w360dp h686dp 480dpi nrml long port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 0, 0) mAppBounds=Rect(0, 90 - 1080, 2150) mWindowingMode=fullscreen mActivityType=undefined} nonFullScreen=0 suim:4 s.48} for app:com.ababeel.ababeel V/ActivityThread(26513): callActivityOnCreate I/HwPhoneWindow(26513): updateLayoutParamsColor false mSpecialSet=false, mForcedNavigationBarColor=false, navigationBarColor=0, mNavBarShow=false, mIsFloating=false I/HwPhoneWindow(26513): updateLayoutParamsColor true mSpecialSet=false, mForcedNavigationBarColor=false, navigationBarColor=ff000000, mNavBarShow=false, mIsFloating=false D/ActivityThread(26513): add activity client record, r= ActivityRecord{97550af token=android.os.BinderProxy@c1a388c {com.ababeel.ababeel/com.facebook.FacebookActivity}} token= android.os.BinderProxy@c1a388c D/ZrHung.AppEyeUiProbe(26513): notify runnable to start. D/OpenGLRenderer(26513): HWUI Binary is enabled I/HwPhoneWindow(26513): updateLayoutParamsColor false mSpecialSet=false, mForcedNavigationBarColor=false, navigationBarColor=ff000000, mNavBarShow=true, mIsFloating=false I/HiTouch_HiTouchSensor(26513): enabledInPad = false,isPcCastMode = false D/HiTouch_PressGestureDetector(26513): onAttached, package=com.ababeel.ababeel, windowType=1, mHiTouchRestricted=false D/ZrHung.AppEyeUiProbe(26513): stop checker. D/mali_winsys(26513): EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface , EGLBoolean) returns 0x3000 I/ViewRootImpl(26513): jank_removeInvalidNode all the node in jank list is out of time D/OpenGLRenderer(26513): HWUI Binary is enabled D/ZrHung.AppEyeUiProbe(26513): Current Activity:false D/ZrHung.AppEyeUiProbe(26513): not watching, wait. D/ZrHung.AppEyeUiProbe(26513): notify runnable to start. D/ZrHung.AppEyeUiProbe(26513): restart watching W/InputMethodManager(26513): startInputReason = 1 D/ZrHung.AppEyeUiProbe(26513): stop checker. D/ZrHung.AppEyeUiProbe(26513): notify runnable to start. W/InputMethodManager(26513): startInputReason = 1 I/flutter (26513): LoginStatus.failed D/ViewRootImplFacebookActivity: surface should not be released D/ActivityThread(26513): Remove activity client record, r= ActivityRecord{97550af token=android.os.BinderProxy@c1a388c {com.ababeel.ababeel/com.facebook.FacebookActivity}} token= android.os.BinderProxy@c1a388c W/libEGL (26513): EGLNativeWindowType 0x7d62be9010 disconnect failed

Flutter doctor -v [√] Flutter (Channel stable, 2.0.2, on Microsoft Windows [Version 10.0.19042.1237], locale en-US) • Flutter version 2.0.2 at C:\src\flutter • Framework revision 8962f6dc68 (7 months ago), 2021-03-11 13:22:20 -0800 • Engine revision 5d8bf811b3 • Dart version 2.12.1

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\shahi\AppData\Local\Android\sdk • Platform android-30, build-tools 30.0.3 • Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) • All Android licenses accepted.

[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Android Studio • Android Studio at C:\Program Files\Android\Android Studio1 • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • android-studio-dir = C:\Program Files\Android\Android Studio1 • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[√] VS Code (version 1.60.2) • VS Code at C:\Users\shahi\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.26.0

[√] Connected device (4 available) • ANE LX1 (mobile) • 9WVDU18418001867 • android-arm64 • Android 9 (API 28) • sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator) • Chrome (web) • chrome • web-javascript • Google Chrome 94.0.4606.61 • Edge (web) • edge • web-javascript • Microsoft Edge 93.0.961.52

• No issues found!

Packages i used cupertino_icons: ^1.0.2 http: ^0.13.3 firebase_core: ^1.7.0 flutter_facebook_auth: ^3.5.2

my manifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="my packege">

<application android:label="social_app" android:icon="@mipmap/ic_launcher"> <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>

<activity android:name="com.facebook.FacebookActivity"
    android:configChanges=
            "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
    android:label="@string/app_name" />
<activity
    android:name="com.facebook.CustomTabActivity"
    android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="@string/fb_login_protocol_scheme" />
    </intent-filter>
</activity>

    <activity
        android:name=".MainActivity"
        android:launchMode="singleTop"
        android:theme="@style/LaunchTheme"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:hardwareAccelerated="true"
        android:windowSoftInputMode="adjustResize">
        <!-- Specifies an Android theme to apply to this Activity as soon as
             the Android process has started. This theme is visible to the user
             while the Flutter UI initializes. After that, this theme continues
             to determine the Window background behind the Flutter UI. -->
        <meta-data
          android:name="io.flutter.embedding.android.NormalTheme"
          android:resource="@style/NormalTheme"
          />
        <!-- Displays an Android View that continues showing the launch screen
             Drawable until Flutter paints its first frame, then this splash
             screen fades out. A splash screen is useful to avoid any visual
             gap between the end of Android's launch screen and the painting of
             Flutter's first frame. -->
        <meta-data
          android:name="io.flutter.embedding.android.SplashScreenDrawable"
          android:resource="@drawable/launch_background"
          />
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>

    <!-- Don't delete the meta-data below.
         This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
    <meta-data
        android:name="flutterEmbedding"
        android:value="2" />
</application>

string.xml

<?xml version="1.0" encoding="utf-8"?>

my app name my app id fb my app id

my function

Future<List> facebookSignin() async { try { final _instance = FacebookAuth.instance; print("Erro! nnnnn");

  final result = await _instance.login(permissions: ["public_profile", "email"],);
  print(result.status);
} catch (e) {
  return ["Erro! aaaaaaaa", e.toString()];
}

}

when i hit this function facebook dialogue appear for a second and then gone

darwin-morocho commented 2 years ago

run the android folder using android studio and in the logcat try to see if you have an error. Also remember set the correct key hash in your facebook developer console.

for windows users is a common mistake the key hash in debug mode. the better option is use native code to get the correct key hash.

https://developers.facebook.com/docs/facebook-login/android/advanced

if you are trying to test the login flow using facebook accounts that do not belongs to any developer your app needs to be in live mode in your facebook developer console

shahid31346 commented 2 years ago

run the android folder using android studio and in the logcat try to see if you have an error. Also remember set the correct key hash in your facebook developer console.

for windows users is a common mistake the key hash in debug mode. the better option is use native code to get the correct key hash.

https://developers.facebook.com/docs/facebook-login/android/advanced

if you are trying to test the login flow using facebook accounts that do not belongs to any developer your app needs to be in live mode in your facebook developer console

i ran the android folder through android studio same log as above. i was thinking if i did something wrong in configuration then how it is working on android emulator it is working on emulator

i use this commend to create debug hash key , with my paths and put the password 'android'

  keytool -exportcert -alias androiddebugkey -keystore "C:\Users\USERNAME\.android\debug.keystore" | "PATH_TO_OPENSSL_LIBRARY\bin\openssl" sha1 -binary | "PATH_TO_OPENSSL_LIBRARY\bin\openssl" base64

  and also i am runing it debug mode , and the status in real device is status.failed.
darwin-morocho commented 2 years ago

Print the error message in the console. Use result.message

shahid31346 commented 2 years ago

result.message

SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]:

darwin-morocho commented 2 years ago

result.message

SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]:

https://stackoverflow.com/questions/41861564/server-error-code-1675030-message-error-performing-query

shahid31346 commented 2 years ago

result.message

SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]:

try to get the key hash using native code

Thank you for your cooperation, i did not get your point , how? currently i open cmd in jdk bin folder and run the above keytool command in there.

darwin-morocho commented 2 years ago

result.message

SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]:

try to get the key hash using native code

Thank you for your cooperation, i did not get your point , how? currently i open cmd in jdk bin folder and run the above keytool command in there.

for windows users is a common mistake the key hash in debug mode. the better option is use native code to get the correct key hash.

https://developers.facebook.com/docs/facebook-login/android/advanced

but you can check other posibles solutions https://stackoverflow.com/questions/41861564/server-error-code-1675030-message-error-performing-query

rvngbrl commented 2 years ago

I found out the solution that you need to provide a release hashkey in Facebook developer rather than the openssl which is a debug key. to generate go to this link "https://tomeko.net/online_tools/hex_to_base64.php?lang=en" and paste your Sha-1 in hex string then convert copy the output base 64 then paste it in your facebook developer key hash

shahid31346 commented 2 years ago

The problem was solved when i generate the hash key with this ssl, openssl-0.9.8e_X64.zip .

Nishtha-Iwebservices commented 2 years ago

SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]: Am getting this in result.message

darwin-morocho commented 2 years ago

SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]:

Please add more info. Are you getting this message after success login? How are you getting the user data? Are you using test users? Is your app in production or dev mode in facebook console?

Nishtha-Iwebservices commented 2 years ago

SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]:

Please add more info. Are you getting this message after success login? How are you getting the user data? Are you using test users? Is your app in production or dev mode in facebook console?

As soon as am taping on login with facebook button, dialog appears with facebook logo, and dismiss suddenly.

darwin-morocho commented 2 years ago

SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]:

Please add more info. Are you getting this message after success login? How are you getting the user data? Are you using test users? Is your app in production or dev mode in facebook console?

As soon as am taping on login with facebook button, dialog appears with facebook logo, and dismiss suddenly.

it seems a bad key hash if you are on windows try to get your debug key hash using native code

Nishtha-Iwebservices commented 2 years ago

SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]:

Please add more info. Are you getting this message after success login? How are you getting the user data? Are you using test users? Is your app in production or dev mode in facebook console?

As soon as am taping on login with facebook button, dialog appears with facebook logo, and dismiss suddenly.

it seems a bad key hash if you are on windows try to get your debug key hash using native code

I am using ubuntu OS.

keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH | openssl sha1 -binary | openssl base64 using above command to get hash key.

testing in development mode.

darwin-morocho commented 2 years ago

SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]:

Please add more info. Are you getting this message after success login? How are you getting the user data? Are you using test users? Is your app in production or dev mode in facebook console?

As soon as am taping on login with facebook button, dialog appears with facebook logo, and dismiss suddenly.

it seems a bad key hash if you are on windows try to get your debug key hash using native code

I am using ubuntu OS.

keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH | openssl sha1 -binary | openssl base64 using above command to get hash key.

In lastest version of the android sdk the debug.keystore needs the password "android" to generate the correct key hash

darwin-morocho commented 2 years ago

SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]:

Please add more info. Are you getting this message after success login? How are you getting the user data? Are you using test users? Is your app in production or dev mode in facebook console?

As soon as am taping on login with facebook button, dialog appears with facebook logo, and dismiss suddenly.

it seems a bad key hash if you are on windows try to get your debug key hash using native code

I am using ubuntu OS. keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH | openssl sha1 -binary | openssl base64 using above command to get hash key.

In lastest version of the android sdk the debug.keystore needs the password "android" to generate the correct key hash

the better option is use native code to get the correct key hash.

https://developers.facebook.com/docs/facebook-login/android/advanced

Nishtha-Iwebservices commented 2 years ago

SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]:

Please add more info. Are you getting this message after success login? How are you getting the user data? Are you using test users? Is your app in production or dev mode in facebook console?

As soon as am taping on login with facebook button, dialog appears with facebook logo, and dismiss suddenly.

it seems a bad key hash if you are on windows try to get your debug key hash using native code

I am using ubuntu OS. keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH | openssl sha1 -binary | openssl base64 using above command to get hash key.

In lastest version of the android sdk the debug.keystore needs the password "android" to generate the correct key hash

yes

Nishtha-Iwebservices commented 2 years ago

SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]:

Please add more info. Are you getting this message after success login? How are you getting the user data? Are you using test users? Is your app in production or dev mode in facebook console?

As soon as am taping on login with facebook button, dialog appears with facebook logo, and dismiss suddenly.

it seems a bad key hash if you are on windows try to get your debug key hash using native code

I am using ubuntu OS. keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH | openssl sha1 -binary | openssl base64 using above command to get hash key.

In lastest version of the android sdk the debug.keystore needs the password "android" to generate the correct key hash

the better option is use native code to get the correct key hash.

https://developers.facebook.com/docs/facebook-login/android/advanced

but am not getting any wrong hash key error

darwin-morocho commented 2 years ago

SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]:

Please add more info. Are you getting this message after success login? How are you getting the user data? Are you using test users? Is your app in production or dev mode in facebook console?

As soon as am taping on login with facebook button, dialog appears with facebook logo, and dismiss suddenly.

it seems a bad key hash if you are on windows try to get your debug key hash using native code

I am using ubuntu OS. keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH | openssl sha1 -binary | openssl base64 using above command to get hash key.

In lastest version of the android sdk the debug.keystore needs the password "android" to generate the correct key hash

the better option is use native code to get the correct key hash. https://developers.facebook.com/docs/facebook-login/android/advanced

but am not getting any wrong hash key error

Sorry As I said your problem is not a bug of this plugin. It is a missing or wrong configuration in your facebook dev console. Try using native code to get your correct key hash https://developers.facebook.com/docs/facebook-login/android/advanced