Aksh
Aksh

Reputation: 323

Firebase Auth error with Facebook AccountKit

Is it valid to use AccountKit's phone auth with Firebase authentication? (Instead of firebase supported facebook auth)

With this code:

 private void handleFacebookAccessToken() {

    AccessToken accessToken = AccountKit.getCurrentAccessToken();

    String TAG = "TokenOperation";
    Log.d(TAG, "handleFacebookAccessToken:" + accessToken);

    AuthCredential credential = FacebookAuthProvider.getCredential(accessToken.getToken());
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (task.isSuccessful()) {
                        // Sign in success, update UI with the signed-in user's information
                        Log.d("", "signInWithCredential:success");
                        FirebaseUser user = mAuth.getCurrentUser();
                        Toast.makeText(DetailsInputDialog.this, "Firebase:" + user.getUid(), Toast.LENGTH_LONG).show();
                    } else {
                        // If sign in fails, display a message to the user.
                        Log.w(TAG, "signInWithCredential:failure", task.getException());
                        Toast.makeText(DetailsInputDialog.this, "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    }
                    // ...
                }
            });
}

Considering accessToken is not null, errors shows up with failed firebase authentication:

An internal error has occured. [ invalid access_token, error code 43. ]

Upvotes: 0

Views: 284

Answers (0)

Related Questions