Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,15 @@ class IdTokenResult {
/// custom, phone, password, etc). Note, this does not map to provider IDs.
String? get signInProvider => _data.signInProvider;

/// The type of second factor associated with this session, provided the user
/// was multi-factor authenticated (for example, phone, etc.).
String? get signInSecondFactor => _data.signInSecondFactor;

/// The Firebase Auth ID token JWT string.
String? get token => _data.token;

@override
String toString() {
return '$IdTokenResult(authTime: $authTime, claims: $claims, expirationTime: $expirationTime, issuedAtTime: $issuedAtTime, signInProvider: $signInProvider, token: $token)';
return '$IdTokenResult(authTime: $authTime, claims: $claims, expirationTime: $expirationTime, issuedAtTime: $issuedAtTime, signInProvider: $signInProvider, signInSecondFactor: $signInSecondFactor, token: $token)';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:flutter_test/flutter_test.dart';

void main() {
const String kMockSignInProvider = 'password';
const String kMockSignInSecondFactor = 'phone';
const String kMockToken = 'test-token';
const int kMockExpirationTimestamp = 1234566;
const int kMockAuthTimestamp = 1234567;
Expand All @@ -23,6 +24,7 @@ void main() {
authTimestamp: kMockAuthTimestamp,
expirationTimestamp: kMockExpirationTimestamp,
signInProvider: kMockSignInProvider,
signInSecondFactor: kMockSignInSecondFactor,
token: kMockToken);

group('$IdTokenResult', () {
Expand All @@ -38,6 +40,8 @@ void main() {
expect(idTokenResult.issuedAtTime!.millisecondsSinceEpoch,
equals(kMockIssuedAtTimestamp));
expect(idTokenResult.signInProvider, equals(kMockSignInProvider));
expect(
idTokenResult.signInSecondFactor, equals(kMockSignInSecondFactor));
expect(idTokenResult.token, equals(kMockToken));
});
});
Expand All @@ -53,6 +57,7 @@ void main() {
authTimestamp: kMockAuthTimestamp,
expirationTimestamp: kMockExpirationTimestamp,
signInProvider: kMockSignInProvider,
signInSecondFactor: kMockSignInSecondFactor,
token: kMockToken);

final testIdTokenResult = IdTokenResult(kMockData);
Expand All @@ -62,7 +67,7 @@ void main() {

test('toString()', () {
expect(idTokenResult.toString(),
'$IdTokenResult(authTime: ${idTokenResult.authTime}, claims: $kMockClaims, expirationTime: ${idTokenResult.expirationTime}, issuedAtTime: ${idTokenResult.issuedAtTime}, signInProvider: $kMockSignInProvider, token: $kMockToken)');
'$IdTokenResult(authTime: ${idTokenResult.authTime}, claims: $kMockClaims, expirationTime: ${idTokenResult.expirationTime}, issuedAtTime: ${idTokenResult.issuedAtTime}, signInProvider: $kMockSignInProvider, signInSecondFactor: $kMockSignInSecondFactor, token: $kMockToken)');
});
});
}
Loading