13

I'm using react-native-fbsdk: 0.8.0, react-native-firebase: ^5.2.2, react-native: ^0.57.4 and Facebook Test User account.

This happened so suddenly. Once I sign out from firebase and try to log in again with Facebook.

Error: The supplied auth credential is malformed or has expired. [ Remote site 5XX from facebook.com for USER_INFO ].

I had tried AccessToken.refreshCurrentAccessTokenAsync(). But give me Error: Failed to refresh access token.

The Facebook token will expire in 60 days. Checked the token expired date is Apr 29, 2019. Change the test user account password and re-login again, still the same.

Is there anything I need to do in facebook or firebase setting?

const result = await LoginManager.logInWithReadPermissions(["public_profile","email"]);

if (result.isCancelled) {
  this.setState({isLoading : false});
  Alert.alert('Error','Login cancelled. Please try again');
} else {              
  try{
    await AccessToken.refreshCurrentAccessTokenAsync();
  }catch(err){
    this.setState({isLoading : false});
    console.log('ereee',err);
  }

  const data = await AccessToken.getCurrentAccessToken();        
  var credential = firebase.auth.FacebookAuthProvider.credential(data.accessToken);
  console.log(data.accessToken);
  //here I get expired date is 2019 April 29
  console.log(moment(data.expirationTime).toDate());

  firebase.auth().signInWithCredential(credential)
    .then((usercredential)=>{                  
      if (usercredential){       
      }else{
        this.setState({isLoading : false});
      }
    })
    .catch((error) => {  
      console.log(error);
    }      
}
Vasilisa
  • 4,604
  • 3
  • 20
  • 25
Kyo Kurosagi
  • 2,177
  • 1
  • 18
  • 18

10 Answers10

10

In my case; i got rid of this error when i turned off "Is App Secret embedded in the client?" in: Facebook for developers -> Settings -> Advanced.

Note: This option is visible if "Native or desktop app?" is enabled.

Eren
  • 2,583
  • 2
  • 31
  • 36
8

If the app secret is wrong in firebase than this problem occurs

if the access token is entered wrong than also this problem occurs

sanjay seju
  • 111
  • 1
  • 8
3

I know that is not a real solution.. but I've added a logout function before the signIn. I had no problems yet. The problem consists of the same user tried to connect multiple times without a proper logout.

3

I face this issue in Unity, Firebase Authentication using FB.

There are five possible types: Consumer, Business, Instant Games, Gaming Services, Workplace, or None. (Reference - developers.facebook.com/docs)

First, have created the Facebook app Type as Gaming Services this Auth method not accepted by Firebase.

I got rid of this error when I have created the app Type as None

2

I had the same issue, when it turned out I forgot to set the correct API keys and secret in the Firebase console (Authentication methods).

mrsimply
  • 413
  • 1
  • 4
  • 10
2

Had the same issue, it's gone after restarting the device

Hai nguyen thanh
  • 718
  • 7
  • 17
1

It is probably not helpful for OP as question is old but today I had exactly the same issue when implementing 3rd party login with Firebase and this question popped up as top result on the Google.

I had the same error message during implementation of GitHub login. The issue was on my side as I wrongly copied API and secret API keys.

Double check your keys and make sure you didn't copy anything extra like I did (it had extra space + extra word).

Ondřej Ševčík
  • 1,049
  • 3
  • 15
  • 31
  • 1
    this error is weird because it used to work for some time. after some few logins, it then gives out this error all the time unless i supply a new google account to try and log in. but those existing ones in the list that were logged in before will keep on giving out the same error message. – chitgoks Nov 29 '19 at 06:21
1

In my case Admin should go to the Facebook app console and complete Data Use Checkup.

enter image description here

Sergio
  • 27,326
  • 8
  • 128
  • 149
1

I've faced this error when using Firebase in Unity to authenticate a Facebook Test User. I've double checked all the project settings and compared my codes with various examples and docs.

Turns out the solution was much simpler than I thought. FB dev console test user access token choice

When you try to get an access token for the test user, choose "Facebook" as the domain instead of "Gaming", even though you think you are making a game.

Samuel
  • 113
  • 2
  • 8
0

In my case, I had added the wrong bundle ID/ iOS application to Firebase. So I went back to the project on Firebase, clicked Settings icon, clicked Project Settings, and removed the iOS app, and re-added the correct application.

This could potentially fix problems on Android too, ensure the package name is correct.

Ben Butterworth
  • 22,056
  • 10
  • 114
  • 167