How to retrieve an Facebook-AuthToken from the accounts saved on Android

前端 未结 4 944
春和景丽
春和景丽 2020-12-10 07:29

I\'m trying to retrieve the AuthToken for Facebook (saved by Facebook for Android) by using the following piece of code.

AccountManager am =         


        
4条回答
  •  有刺的猬
    2020-12-10 07:55

    To explain the fact that neither of your logging statements are being reached, consider:

    Line ~8:

            am.getAuthToken(account, "com.facebook.auth.login", null, ConversationList.this,
    

    ... can return a token if it's immediately available. Maybe that's the answer you're looking for? Quoting the AccountManager documentation:

    If a previously generated auth token is cached for this account and type, then it is returned. Otherwise, if a saved password is available, it is sent to the server to generate a new auth token. Otherwise, the user is prompted to enter a password.

提交回复
热议问题