Logging into the Facebook SDK with an existing token

I am developing an Android application and support social media support. And now I am faced with a problem related to logging in and out of the Facebook SDK. On our server we save an access token for each used social network. What I want to do:

  • The user has an account with a Google account and a Facebook account.

  • users log out = it is unloaded from the Google SDK and SDK

  • users register with Google

  • he gets facebook token information

  • he was automatically logged in with facebook

I tried to look at the LoginManager class, but could not find the path to the access token.

I also noticed that there is a way to set the access token on the AccessToken object. But I need to clarify how to implement it correctly and according to the logic of this

+4
source share
1 answer

You cannot automatically connect the Facebook SDK using tokens, even the application is already registered. You need to ask the user to get a new access token again.

On the other hand, facebook tokens taken from mobile sdk are short-term tokens without replacing it with a long-term token. The backend must request a long-term one with the given. Therefore, storing this file may be inefficient.

It is better to feed your profile data with data obtained from Facebook and Google.

, , .

+3

Source: https://habr.com/ru/post/1688119/


All Articles