Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firestore - Facebook Invalid OAuth access token signature code 190

I am trying to include facebook login on my android app. But eventhough I've followed docs in firebase and facebook, I still couldn't made it. When I click login button facebook gives me this following error:

com.google.firebase.auth.FirebaseAuthInvalidCredentialsException: The supplied auth credential is malformed or has expired. [ Unsuccessful debug_token response from Facebook: {"error":{"message":"Invalid OAuth access token signature.","type":"OAuthException","code":190,"fbtrace_id":"ENYy8qUQd+C"}} ]

I registered developers.facebook, carried out my App ID and App Secret to firebase auth part. After I included my keyhash and valid oAuth redirect URI, still can not overcome this issue. Here is my codes in android;

in oncreate;

    mCallbackManager = CallbackManager.Factory.create();
    loginButton = findViewById(R.id.facebook_login);
    loginButton.setReadPermissions("email");

    loginButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            signFb();
        }
    });

After oncreate I have this method for registerCallback.

private void signFb()
{
    loginButton.registerCallback(mCallbackManager, new FacebookCallback<LoginResult>() {
        @Override
        public void onSuccess(LoginResult loginResult) {
            handleFacebookAccessToken(loginResult.getAccessToken());
        }

        @Override
        public void onCancel() {
            Log.d("aa", "facebook:onCancel");
            // ...
        }

        @Override
        public void onError(FacebookException error) {
            Log.d("aa", "facebook:onError", error);
            Log.d("ere", error.toString());
        }
    });
}



private void handleFacebookAccessToken(AccessToken token) {
    Log.d("asdfgb", "handleFacebookAccessToken:" + token);

    AuthCredential credential = FacebookAuthProvider.getCredential(token.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
                        FirebaseUser user = mAuth.getCurrentUser();
                        Log.d("esgfsgdvcxz ", "onComplete: ASFDSGBHSF");
                        if(user != null) {
                            Intent intent = new Intent(ActivityLogin.this, MainFragmentActivity.class);
                            startActivity(intent);
                            finish();
                            return;
                        }
                    } else {
                        // If sign in fails, display a message to the user.
                        Log.w("asd", "signInWithCredential:failure", task.getException());
                    }

                    // ...
                }
            });
}

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

    // Pass the activity result back to the Facebook SDK
    mCallbackManager.onActivityResult(requestCode, resultCode, data);
}

thank you. I don't think that the problem is in code tho. Because facebook fragment comes up and I can click continue. But after that, I can't continue.


1 Answers

Solved my problem. I've been coding non-stop for hours and with all those chrome tabs, I realised that I forgot clicking "save" on firebase authentication tab after I pasted App Id etc. Good coding days.


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!