Facebook AccessToken.getAccessToken is null on opening of app even after first login

后端 未结 7 2466
[愿得一人]
[愿得一人] 2020-12-17 16:50

I have integrated latest Facebook android sdk (Sdk 4.0). This is the code I have added in my onCreate method.

FacebookSdk.sdkInitialize(this.getApplication         


        
7条回答
  •  难免孤独
    2020-12-17 17:27

    I have not tested this myself but what I think you can do is to get the AccessToken from the LoginResult object in the onSuccess method of the callback.

    So: AccessToken accessToken = loginResult.getAccessToken();

    Then you would save this accessToken down by saying:

    AccessToken.setAccessToken(accessToken);

    Then when you call AccessToken.getAccessToken, it should return the accessToken you have saved.

提交回复
热议问题