Skip to content

Commit 6cbe9ca

Browse files
committed
getIdToken refresh integration test
1 parent f60f70c commit 6cbe9ca

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/firebase_auth/example/test/firebase_auth.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ void main() {
4040
expect(user.metadata.creationTime.isAfter(DateTime(2018, 1, 1)), isTrue);
4141
expect(user.metadata.creationTime.isBefore(DateTime.now()), isTrue);
4242
final IdTokenResult tokenResult = await user.getIdToken();
43+
final String originalToken = tokenResult.token;
4344
expect(tokenResult.token, isNotNull);
4445
expect(tokenResult.expirationTime.isAfter(DateTime.now()), isTrue);
4546
expect(tokenResult.authTime, isNotNull);
@@ -53,6 +54,9 @@ void main() {
5354
expect(tokenResult.claims['provider_id'], 'anonymous');
5455
expect(tokenResult.claims['firebase']['sign_in_provider'], 'anonymous');
5556
expect(tokenResult.claims['user_id'], user.uid);
57+
// Verify that token will be the same after another getIdToken call with refresh = false option
58+
final IdTokenResult newTokenResultWithoutRefresh = await user.getIdToken(refresh: false);
59+
expect(originalToken, newTokenResultWithoutRefresh.token);
5660
await auth.signOut();
5761
final FirebaseUser user2 = (await auth.signInAnonymously()).user;
5862
expect(user2.uid, isNot(equals(user.uid)));

0 commit comments

Comments
 (0)