FirebaseExtended / FirebaseExtended/flutterfire_desktop

🐛 [firebase_auth] type 'DateTime' is not a subtype of type 'int' when trying to read IdTokenResult.expirationTime

Open
#107 4 comments 0 reactions 0 assignees View on GitHub
hacktoberfest
Dominant language
Dart
Stars
414
Forks
62
PR merge metrics
No merged PRs in 30d

Description

## Bug report

**Describe the bug**
The below error gets thrown when trying to read the IdTokenResult expiration time. I believe that this is due to [this](https://github.com/invertase/flutterfire_desktop/blob/dc9d029d9e08d88b9803b9a3c835a9799b6fa494/packages/firebase_auth/firebase_auth_dart/lib/src/id_token_result.dart#L55) line, where you should provide a unix timestamp in the form of an int instead of a DateTime object. This occurs on flutter linux and flutter windows

### Steps to reproduce

Steps to reproduce the behavior:

1. Use the sample code below

### Expected behavior

Expected to get the actual token expiration time.

### Sample code

```dart
final user = await _fbAuth.signInWithEmailAndPassword(email: email, password: password);
IdTokenResult tokenResult = await user.getIdTokenResult();
print(tokenResult.expirationTime); // Error
```

---

## Additional context

Stack trace:
```
type 'DateTime' is not a subtype of type 'int'
File "id_token_result.dart", line 38, col 50, in IdTokenResult.expirationTime
```

Package versions:
```yaml
firebase_core: ^1.20.1
firebase_auth: ^3.6.3
firebase_messaging: ^12.0.2
firebase_core_desktop: ^1.0.2
firebase_auth_desktop: ^1.0.2
```

My current workaround for this is to parse the JWT myself from `IdTokenResult.token` and read the `exp` field.

---

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.