简体   繁体   中英

Android - Firebase login based on facebook and calling Facebook Graph Api Issue

I'm using firebase login based on Facebook Credentials, and I'm unable to call Facebook SDK methods.

The problem appears when returning user open the app, I'm checking if a user is logged in with

 FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();

if the user is not null he is logged in and enter the app.

Next thing I'm trying to call Facebook Graph Request using

  AccessToken token = AccessToken.getCurrentAccessToken();

but token return as null.

What is missing? is there a function that needs to be called after Firebase login so the Facebook SDK will be initialized with the right access token?

Firebase Simple Login now supports authenticating a user with an existing Facebook access token, meaning that you can easily use the Facebook JS SDK in combination with Firebase Simple Login without asking your users to authenticate twice.

For example, once you have a valid Facebook access token using the Facebook JS SDK:

var ref = new Firebase(...);
var auth = new FirebaseSimpleLogin(ref, function(error, user) { ... });
auth.login('facebook', { access_token: '<ACCESS_TOKEN>' });

See the access_token option at https://www.firebase.com/docs/security/simple-login-facebook.html for more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM