Skip to content

Commit

Permalink
Fix hasAccessToken check (jeduan#853)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
blackwolf12333 authored Mar 13, 2020
1 parent a9700a8 commit a5edc20
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/android/ConnectPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,12 @@ private ShareLinkContent buildContent(Map<String, String> 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) {
Expand Down

0 comments on commit a5edc20

Please sign in to comment.