Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error 100 while logging with Facebook into Firebase

I'm trying to sign in with facebook into firebase. Facebook log-in works, but firebase throw an error. BTW Google sign in works perfectly (I've removed GSI code to make it shorter), so I'm highly doubt, that the problem is in Firebase. Here is logs

08-30 11:43:43.091 25460-25460/com.kid.gl W/StartActivity: signInWithCredential
                                                       com.google.firebase.FirebaseException: An internal error has occured. [ Unsuccessful debug_token response from Facebook: {"error":{"message":"(#100) You must provide an app access token or a user access token that is an owner or developer of the app","type":"OAuthException","code":100,"fbtrace_id":"GLp5H2ygSPb"}} ]
                                                           at com.google.android.gms.internal.zzafd.zzes(Unknown Source)
                                                           at com.google.android.gms.internal.zzafa$zzg.zza(Unknown Source)
                                                           at com.google.android.gms.internal.zzafl.zzet(Unknown Source)
                                                           at com.google.android.gms.internal.zzafl$zza.onFailure(Unknown Source)
                                                           at com.google.android.gms.internal.zzafg$zza.onTransact(Unknown Source)
                                                           at android.os.Binder.execTransact(Binder.java:446)

I was searching that error for about 3 hours, and everywhere found just one solution - turn off "Secret embed in client" in Facebook console settings. That made no effect at all.

public class StartActivity extends AppCompatActivity
    implements  
                View.OnClickListener,
                FacebookCallback<LoginResult> {
private static final String TAG = "StartActivity";
private FirebaseAuth mAuth;
private FirebaseAuth.AuthStateListener mAuthListener;
private CallbackManager callbackManager;

@SuppressWarnings("ConstantConditions")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FacebookSdk.sdkInitialize(getApplicationContext());
    setContentView(R.layout.activity_start);

    mAuth = FirebaseAuth.getInstance();
    mAuthListener = new FirebaseAuth.AuthStateListener() {
        @Override public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
            FirebaseUser user = firebaseAuth.getCurrentUser();
            if (user != null)
                afterLogin();
            else
                logOut();
        }
    };

    //Facebook login
    callbackManager = CallbackManager.Factory.create();
    LoginButton facebookButton = (LoginButton) findViewById(R.id.facebook_login);
    facebookButton.setReadPermissions("public_profile", "email");
    facebookButton.registerCallback(callbackManager, this);
    LoginManager.getInstance().registerCallback(callbackManager,this);
}

@Override public void onStart() {
    super.onStart();
    mAuth.addAuthStateListener(mAuthListener);
}

@Override public void onStop() {
    super.onStop();
    if (mAuthListener != null)
        mAuth.removeAuthStateListener(mAuthListener);
}

@Override public void onActivityResult(int requestCode, int resultCode, Intent data) {
            try { callbackManager.onActivityResult(requestCode, resultCode, data); }
                catch (Exception e) {  e.printStackTrace(); }
}

//Facebook login methods
@Override
public void onSuccess(LoginResult loginResult) {
    //LoginManager.getInstance().logInWithReadPermissions(this, Arrays.asList("public_profile"));
    AuthCredential credential = FacebookAuthProvider.getCredential(loginResult.getAccessToken().getToken());
    mAuth.signInWithCredential(credential).addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) {
        Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());
        if (!task.isSuccessful()) {
            Log.w(TAG, "signInWithCredential", task.getException()); //Exception is here
            Toast.makeText(StartActivity.this, "Authentication failed.", Toast.LENGTH_SHORT).show();
        }
    }});
}
@Override public void onCancel() {}
@Override public void onError(FacebookException error) {
    Toast.makeText(this, error.getLocalizedMessage(), Toast.LENGTH_LONG).show();
}
}

P.S.: Facebook SDK added using gradle, may be that cause of problem? Part of build.gradle:

compile 'com.google.firebase:firebase-auth:9.4.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
like image 685
Dima Rostopira Avatar asked Aug 28 '26 03:08

Dima Rostopira


2 Answers

Finally, I found out, that I've used client code instead of app secret :D My bad, sorry

like image 197
Dima Rostopira Avatar answered Aug 30 '26 19:08

Dima Rostopira


Most likely your Facebook app is still set to be in development mode, which means you must explicitly add the users that have access to it.

  1. go to developers.facebook.com
  2. select your app
  3. click Roles in the left menu
  4. under Testers add the Facebook ID of the user you want to be able to log in

Alternatively, you can make the app public:

  1. go to developers.facebook.com
  2. select your app
  3. click App Review in the left menu
  4. set the slider under Make Holla public? to Yes
like image 25
Frank van Puffelen Avatar answered Aug 30 '26 17:08

Frank van Puffelen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!