Skip to content

Commit b60e0d5

Browse files
Googlera-maurice
authored andcommitted
Adds error handling for MISSING_OR_INVALID_NONCE for cpp wrapper.
PiperOrigin-RevId: 274251480
1 parent ea3d079 commit b60e0d5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

auth/src/android/common_android.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ static const ErrorCodeMapping kCredentialCodes[] = {
6565
{"ERROR_MISSING_MULTI_FACTOR_INFO", kAuthErrorMissingMultiFactorInfo},
6666
{"ERROR_INVALID_MULTI_FACTOR_SESSION", kAuthErrorInvalidMultiFactorSession},
6767
{"ERROR_MULTI_FACTOR_INFO_NOT_FOUND", kAuthErrorMultiFactorInfoNotFound},
68+
{"ERROR_MISSING_OR_INVALID_NONCE", kAuthErrorMissingOrInvalidNonce},
6869
{nullptr},
6970
};
7071
static const ErrorCodeMapping kUserCodes[] = {

auth/src/include/firebase/auth/types.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,11 @@ enum AuthError {
411411
/// Indicates that an error occurred during a Federated Auth UI Flow when the
412412
/// user was prompted to enter their credentials.
413413
kAuthErrorFederatedSignInUserInteractionFailure,
414+
415+
/// Indicates that a request was made with a missing or invalid nonce.
416+
/// This can happen if the hash of the provided raw nonce did not match the
417+
/// hashed nonce in the OIDC ID token payload.
418+
kAuthErrorMissingOrInvalidNonce,
414419
#endif // INTERNAL_EXEPERIMENTAL
415420
};
416421

@@ -426,7 +431,7 @@ struct FederatedProviderData {
426431
/// @brief Contains information to identify an OAuth povider.
427432
struct FederatedOAuthProviderData : FederatedProviderData {
428433
/// Initailizes an empty provider data structure.
429-
FederatedOAuthProviderData() { }
434+
FederatedOAuthProviderData() {}
430435

431436
/// Initializes the provider data structure with a provider id.
432437
explicit FederatedOAuthProviderData(const std::string& provider) {

0 commit comments

Comments
 (0)