roughike / flutter_facebook_login

A Flutter plugin for allowing users to authenticate with native Android & iOS Facebook login SDKs.
BSD 2-Clause "Simplified" License
404 stars 332 forks source link

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

Open ncpleslie opened 4 years ago

ncpleslie commented 4 years ago

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

redbrickred commented 4 years ago

Likely duplicate of #238.

ncpleslie commented 4 years ago

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.