From a5edc2049a403ada4c5b7a2c9fbb78c8cde3fe51 Mon Sep 17 00:00:00 2001 From: Peter Maatman Date: Fri, 13 Mar 2020 13:26:52 +0100 Subject: [PATCH] Fix hasAccessToken check (#853) When an access token is expired this plugin would not fetch a new one. This is invalid behaviour and resulted in failed login attempts because the token was expired, but still passed to the javascript code as a valid token. This patch adds a check if the token is expired as well. --- src/android/ConnectPlugin.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/android/ConnectPlugin.java b/src/android/ConnectPlugin.java index 8e698526f..f02a4575a 100644 --- a/src/android/ConnectPlugin.java +++ b/src/android/ConnectPlugin.java @@ -746,7 +746,12 @@ private ShareLinkContent buildContent(Map paramBundle) { // Simple active session check private boolean hasAccessToken() { - return AccessToken.getCurrentAccessToken() != null; + AccessToken token = AccessToken.getCurrentAccessToken(); + + if (token == null) + return false; + + return !token.isExpired(); } private void handleError(FacebookException exception, CallbackContext context) {