Android – login to the Facebook SDK using an existing token

I am developing an Android application with social network login support. Now I have the problem of logging in and out of the Facebook SDK. On our server, we store access tokens for each social network used. What I want to do:

>The user has a Google login account associated with a Facebook account > User logout = he logs out of the Facebook SDK and the Google SDK > the user logs in using Google > he receives information about Facebook tokens > he automatically logs in to Facebook

I tried to look at the loginmanager class, but I couldn't find any way to log in using an access token

I also noticed that there is a way to set the access token as an accesstoken object, but I need to clarify how to implement it correctly and the logic behind it

resolvent:

Even if the application is logged in, you cannot automatically connect the Facebook SDK to the token. You need to ask the user again to get a new access token

On the other hand, the Facebook token obtained from the Mobile SDK is short-term tokens unless it is replaced with a long-term token. The back end needs to request long-term one with a given one. Therefore, it may be useless to store it

It's best to use the data provided by Facebook and Google to provide your personal information

The way you found to set the access token only applies to custom token refresh structures

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>