facebookarchive / react-native-fbsdk

A React Native wrapper around the Facebook SDKs for Android and iOS. Provides access to Facebook login, sharing, graph requests, app events etc.
https://developers.facebook.com/docs/react-native
Other
2.99k stars 907 forks source link

Error code : auth/invalid-credential, The supplied auth credential is malformed or has expired (IOS) #645

Open tusharmutreja opened 5 years ago

tusharmutreja commented 5 years ago

Hey guys,

I try to login Facebook from IOS APP. But getting ERROR : Error: The supplied auth credential is malformed or has expired. Initially, it works fine, but suddenly got this error .

This is my code

` const result = await LoginManager.logInWithPermissions(['public_profile', 'email']); console.log('result', result); if (result.isCancelled) { this.isLoading = false; return; // throw new Error('User cancelled request'); // Handle this however fits the flow of your app } const data = await AccessToken.getCurrentAccessToken(); console.log(data, 'data'); if (!data) { this.isLoading = false; Toast.show(Constant.ErrorMessages.FacebookError); return; } const userLargeImage = await this.fetchLargeProfileImage(data); const credential = firebase.auth.FacebookAuthProvider.credential(data.accessToken); // login with credential const currentUser = await firebase.auth().signInWithCredential(credential); const { id, email, first_name, last_name } = currentUser.additionalUserInfo.profile // const { photoURL } = currentUser.user let savingTime = new Date().getTime();

`

roger-ngx commented 4 years ago

is there any update for this, i got the same error i figured out that I made a mismatch with FacebookAppId setting on iOS and Firebase