Giter Site home page Giter Site logo

Comments (6)

PrincewillIroka avatar PrincewillIroka commented on July 16, 2024 2

I've sorted the issue. @zRelux Thanks for your suggestion and @mikehardy thanks for your efforts too.
I also found out that I was making a mistake by trying to access the user credentials from here directly:

const result = await LoginManager.logInWithPermissions([
      'public_profile',
      'email',
 ]);
console.log(result)

I had to get the user AccessToken, pass it unto auth (from '@react-native-firebase/auth) before gaining access to the user credentials.

import auth from '@react-native-firebase/auth';

    if (result.isCancelled) {
      throw 'User cancelled the login process';
    }

    // Once signed in, get the users AccessToken
    const data = await AccessToken.getCurrentAccessToken();

    if (!data) {
      throw 'Something went wrong obtaining access token';
    }

    // Create a Firebase credential with the AccessToken
    const facebookCredential = auth.FacebookAuthProvider.credential(
      data.accessToken,
    );

    // Sign-in the user with the credential
    auth().signInWithCredential(facebookCredential);
    auth().onAuthStateChanged((user)=>console.log(user));

from react-native-fbsdk-next.

mikehardy avatar mikehardy commented on July 16, 2024

Maybe related, react-native-firebase auth is having difficulty consuming the output from this module at the moment, that issue could use more triage before saying it is definitely related: invertase/react-native-firebase#5106

from react-native-fbsdk-next.

thebergamo avatar thebergamo commented on July 16, 2024

@PrincewillIroka thanks for reporting this bug.
Does it happen all the time?
Would you mind to clone this repo and implement some test for it in order to reproduce?

That would help me a lot in order to debug it and specially having your constraints (environment and platform) set to reproduce :)

from react-native-fbsdk-next.

zRelux avatar zRelux commented on July 16, 2024

Be sure to check that you have enabled the facebook auth in the firebase console. I had the same issue, and enabling it fixed the problem

from react-native-fbsdk-next.

mikehardy avatar mikehardy commented on July 16, 2024

Interesting! That might explain why I have not been able to reproduce it in my project or help (I maintain react-native-firebase and wanted to solve this one...) thanks @zRelux - curious to here from @PrincewillIroka if that was the problem

from react-native-fbsdk-next.

thebergamo avatar thebergamo commented on July 16, 2024

Glad to see that everything went fine in this issue :)

from react-native-fbsdk-next.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.