@@ -60,6 +60,7 @@ static const char kCustomEmail[] = "custom.email@example.com";
6060static const char kCustomPassword [] = " CustomPasswordGoesHere" ;
6161
6262// Constants used during tests.
63+ static const char kTestNonceBad [] = " testBadNonce" ;
6364static const char kTestPassword [] = " testEmailPassword123" ;
6465static const char kTestEmailBad [] = " bad.test.email@example.com" ;
6566static const char kTestPasswordBad [] = " badTestPassword" ;
@@ -882,7 +883,7 @@ extern "C" int common_main(int argc, const char* argv[]) {
882883 WaitForSignInFuture (
883884 facebook_bad,
884885 " Auth::SignInWithCredential() bad Facebook credentials" ,
885- kAuthErrorInvalidProviderId , auth);
886+ kAuthErrorInvalidCredential , auth);
886887 }
887888
888889 // Use bad GitHub credentials. Should fail.
@@ -893,7 +894,7 @@ extern "C" int common_main(int argc, const char* argv[]) {
893894 auth->SignInWithCredential (git_hub_cred_bad);
894895 WaitForSignInFuture (
895896 git_hub_bad, " Auth::SignInWithCredential() bad GitHub credentials" ,
896- kAuthErrorInvalidProviderId , auth);
897+ kAuthErrorInvalidCredential , auth);
897898 }
898899
899900 // Use bad Google credentials. Should fail.
@@ -969,7 +970,6 @@ extern "C" int common_main(int argc, const char* argv[]) {
969970 }
970971 }
971972#endif // TARGET_OS_IPHONE
972-
973973 // Use bad Twitter credentials. Should fail.
974974 {
975975 Credential twitter_cred_bad = TwitterAuthProvider::GetCredential (
@@ -978,7 +978,21 @@ extern "C" int common_main(int argc, const char* argv[]) {
978978 auth->SignInWithCredential (twitter_cred_bad);
979979 WaitForSignInFuture (
980980 twitter_bad, " Auth::SignInWithCredential() bad Twitter credentials" ,
981- kAuthErrorInvalidProviderId , auth);
981+ kAuthErrorInvalidCredential , auth);
982+ }
983+
984+ // Construct OAuthCredential with nonce & access token.
985+ {
986+ Credential nonce_credential_good =
987+ OAuthProvider::GetCredential (kTestIdProviderIdBad , kTestIdTokenBad ,
988+ kTestNonceBad , kTestAccessTokenBad );
989+ }
990+
991+ // Construct OAuthCredential with nonce, null access token.
992+ {
993+ Credential nonce_credential_good = OAuthProvider::GetCredential (
994+ kTestIdProviderIdBad , kTestIdTokenBad , kTestNonceBad ,
995+ /* access_token=*/ nullptr );
982996 }
983997
984998 // Use bad OAuth credentials. Should fail.
@@ -988,7 +1002,18 @@ extern "C" int common_main(int argc, const char* argv[]) {
9881002 Future<User*> oauth_bad = auth->SignInWithCredential (oauth_cred_bad);
9891003 WaitForSignInFuture (
9901004 oauth_bad, " Auth::SignInWithCredential() bad OAuth credentials" ,
991- kAuthErrorInvalidProviderId , auth);
1005+ kAuthErrorFailure , auth);
1006+ }
1007+
1008+ // Use bad OAuth credentials with nonce. Should fail.
1009+ {
1010+ Credential oauth_cred_bad =
1011+ OAuthProvider::GetCredential (kTestIdProviderIdBad , kTestIdTokenBad ,
1012+ kTestNonceBad , kTestAccessTokenBad );
1013+ Future<User*> oauth_bad = auth->SignInWithCredential (oauth_cred_bad);
1014+ WaitForSignInFuture (
1015+ oauth_bad, " Auth::SignInWithCredential() bad OAuth credentials" ,
1016+ kAuthErrorFailure , auth);
9921017 }
9931018
9941019 // Test Auth::SendPasswordResetEmail().
@@ -1077,7 +1102,7 @@ extern "C" int common_main(int argc, const char* argv[]) {
10771102 anonymous_user->LinkWithCredential (twitter_cred_bad);
10781103 WaitForFuture (link_bad_future,
10791104 " User::LinkWithCredential() with bad credential" ,
1080- kAuthErrorInvalidProviderId );
1105+ kAuthErrorInvalidCredential );
10811106 ExpectTrue (" Linking maintains user" ,
10821107 auth->current_user () == pre_link_user);
10831108 }
@@ -1094,7 +1119,7 @@ extern "C" int common_main(int argc, const char* argv[]) {
10941119 auth->SignInWithCredential (twitter_cred_bad);
10951120 WaitForFuture (signin_bad_future,
10961121 " Auth::SignInWithCredential() with bad credential" ,
1097- kAuthErrorInvalidProviderId , auth);
1122+ kAuthErrorInvalidCredential , auth);
10981123 ExpectTrue (" Failed sign in maintains user" ,
10991124 auth->current_user () == pre_signin_user);
11001125 }
@@ -1270,7 +1295,7 @@ extern "C" int common_main(int argc, const char* argv[]) {
12701295 LogMessage (" Setting up provider data" );
12711296 firebase::auth::FederatedOAuthProviderData provider_data;
12721297 provider_data.provider_id =
1273- firebase::auth::GoogleAuthProvider::GetProviderId () ;
1298+ firebase::auth::GoogleAuthProvider::kProviderId ;
12741299 provider_data.provider_id = " google.com" ;
12751300 provider_data.scopes = {
12761301 " https://www.googleapis.com/auth/fitness.activity.read" };
@@ -1299,7 +1324,7 @@ extern "C" int common_main(int argc, const char* argv[]) {
12991324 // --- SignInWithProvider ---
13001325 firebase::auth::FederatedOAuthProviderData provider_data;
13011326 provider_data.provider_id =
1302- firebase::auth::GoogleAuthProvider::GetProviderId () ;
1327+ firebase::auth::GoogleAuthProvider::kProviderId ;
13031328 provider_data.custom_parameters = {{" req_id" , " 1234" }};
13041329
13051330 firebase::auth::FederatedOAuthProvider provider;
@@ -1321,7 +1346,7 @@ extern "C" int common_main(int argc, const char* argv[]) {
13211346 } else {
13221347 firebase::auth::FederatedOAuthProviderData provider_data;
13231348 provider_data.provider_id =
1324- firebase::auth::GoogleAuthProvider::GetProviderId () ;
1349+ firebase::auth::GoogleAuthProvider::kProviderId ;
13251350 provider_data.custom_parameters = {{" req_id" , " 1234" }};
13261351
13271352 firebase::auth::FederatedOAuthProvider provider;
0 commit comments