flutter_facebook_login icon indicating copy to clipboard operation
flutter_facebook_login copied to clipboard

Token expiry is 1969-12-31 23:59:59.999Z

Open ncpleslie opened this issue 4 years ago • 2 comments

The returned token is valid, but the token expiry is 1969-12-31 23:59:59.999Z.

Does this mean it never expires, or does it mean it's expired (even though the token is still valid and can still be used)?

accessToken.isValid() returns false

Device: Android flutter_facebook_login version: 3.0.0 Flutter version: 1.15.17

ncpleslie avatar Apr 11 '20 01:04 ncpleslie

Likely duplicate of #238.

redbrickred avatar Apr 19 '20 00:04 redbrickred

Could be but no error is thrown on my end. The token is valid but the response I get back from flutter_facebook_login is incorrect. This is due to Facebook returning an expiry date of "-1".

result.accessToken.toMap() returns: {token: aValidTokenHereThatIRemoved, userId: aValidUserIdThatIRemoved, expires: -1, permissions: [manage_pages, public_profile, pages_show_list, email], declinedPermissions: [publish_pages]}

Everything is valid, but the flutter code expects valid epoch time. My presumption was that "-1" meant "non-expiring" so added a check for this: final bool isNonExpiringToken = result.accessToken.expires.millisecondsSinceEpoch == -1; and ignored the returned expiry date from flutter_facebook_login with: expiryDate: isNonExpiringToken ? DateTime.now().add(Duration(days: 60)) : result.accessToken.expires) when saving the credentials with shared_preferences.

ncpleslie avatar Apr 19 '20 01:04 ncpleslie