@@ -26,6 +26,7 @@ void main() {
26
26
const String kMockEmail = 'test@example.com' ;
27
27
const String kMockPassword = 'passw0rd' ;
28
28
const String kMockIdToken = '12345' ;
29
+ const String kMockRawNonce = 'abcde12345' ;
29
30
const String kMockAccessToken = '67890' ;
30
31
const String kMockGithubToken = 'github' ;
31
32
const String kMockCustomToken = '12345' ;
@@ -587,6 +588,45 @@ void main() {
587
588
expect (captured.providerId, equals ('apple.com' ));
588
589
expect (captured.idToken, equals (kMockIdToken));
589
590
expect (captured.accessToken, equals (kMockAccessToken));
591
+ expect (captured.rawNonce, equals (null ));
592
+ });
593
+
594
+ test ('OAuthProvider signInWithCredential for Apple with rawNonce' ,
595
+ () async {
596
+ OAuthProvider oAuthProvider = OAuthProvider ('apple.com' );
597
+ final AuthCredential credential = oAuthProvider.credential (
598
+ idToken: kMockIdToken,
599
+ rawNonce: kMockRawNonce,
600
+ accessToken: kMockAccessToken,
601
+ );
602
+ await auth.signInWithCredential (credential);
603
+ final captured =
604
+ verify (mockAuthPlatform.signInWithCredential (captureAny))
605
+ .captured
606
+ .single;
607
+ expect (captured.providerId, equals ('apple.com' ));
608
+ expect (captured.idToken, equals (kMockIdToken));
609
+ expect (captured.rawNonce, equals (kMockRawNonce));
610
+ expect (captured.accessToken, equals (kMockAccessToken));
611
+ });
612
+
613
+ test (
614
+ 'OAuthProvider signInWithCredential for Apple with rawNonce (empty accessToken)' ,
615
+ () async {
616
+ OAuthProvider oAuthProvider = OAuthProvider ('apple.com' );
617
+ final AuthCredential credential = oAuthProvider.credential (
618
+ idToken: kMockIdToken,
619
+ rawNonce: kMockRawNonce,
620
+ );
621
+ await auth.signInWithCredential (credential);
622
+ final captured =
623
+ verify (mockAuthPlatform.signInWithCredential (captureAny))
624
+ .captured
625
+ .single;
626
+ expect (captured.providerId, equals ('apple.com' ));
627
+ expect (captured.idToken, equals (kMockIdToken));
628
+ expect (captured.rawNonce, equals (kMockRawNonce));
629
+ expect (captured.accessToken, equals (null ));
590
630
});
591
631
592
632
test ('PhoneAuthProvider signInWithCredential' , () async {
0 commit comments