[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of error MISSING_CLIENT_IDENTIFIER #3341

Merged
merged 1 commit into from
Jul 12, 2019
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
5 changes: 1 addition & 4 deletions Firebase/Auth/Source/Backend/FIRAuthBackend.m
Original file line number Diff line number Diff line change
Expand Up @@ -1169,10 +1169,7 @@ + (nullable NSError *)clientErrorWithServerErrorMessage:(NSString *)serverErrorM
}

if ([shortErrorMessage isEqualToString:kMissingClientIdentifier]) {
return [FIRAuthErrorUtils appNotVerifiedErrorWithMessage:@"Missing app verification via"
" reCAPTCHA or APNS token. Please verify that appVerificationDisabledForTesting is not"
" enabled when testing with a phone number that is not marked as a test Phone number in the"
" app console."];
return [FIRAuthErrorUtils missingClientIdentifierErrorWithMessage:serverErrorMessage];
}

if ([shortErrorMessage isEqualToString:kCaptchaCheckFailedErrorMessage]) {
Expand Down
4 changes: 4 additions & 0 deletions Firebase/Auth/Source/Public/FIRAuthErrors.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,10 @@ typedef NS_ENUM(NSInteger, FIRAuthErrorCode) {
*/
FIRAuthErrorCodeGameKitNotLinked = 17076,

/** Indicates an error for when the client identifier is missing.
*/
FIRAuthErrorCodeMissingClientIdentifier = 17993,

/** Indicates an error occurred while attempting to access the keychain.
*/
FIRAuthErrorCodeKeychainError = 17995,
Expand Down
7 changes: 7 additions & 0 deletions Firebase/Auth/Source/Utilities/FIRAuthErrorUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,13 @@ NS_ASSUME_NONNULL_BEGIN
*/
+ (NSError *)appNotVerifiedErrorWithMessage:(nullable NSString *)message;

/** @fn missingClientIdentifierErrorWithMessage:
@brief Constructs an @c NSError with the @c FIRAuthErrorCodeMissingClientIdentifier code.
@param message Error message from the backend, if any.
@return The NSError instance associated with the given FIRAuthError.
*/
+ (NSError *)missingClientIdentifierErrorWithMessage:(nullable NSString *)message;

/** @fn captchaCheckFailedErrorWithMessage:
@brief Constructs an @c NSError with the @c FIRAuthErrorCaptchaCheckFailed code.
@param message Error message from the backend, if any.
Expand Down
14 changes: 14 additions & 0 deletions Firebase/Auth/Source/Utilities/FIRAuthErrorUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@
"keychain. The @c NSLocalizedFailureReasonErrorKey field in the @c NSError.userInfo dictionary "
"will contain more information about the error encountered";

/** @var kFIRAuthErrorMessageMissingClientIdentifier
@brief Message for @c FIRAuthErrorCodeMissingClientIdentifier error code.
*/
static NSString *const kFIRAuthErrorMessageMissingClientIdentifier = @"The request does not contain "
"any client identifier.";

/** @var kFIRAuthErrorMessageUserTokenExpired
@brief Message for @c FIRAuthErrorCodeTokenExpired error code.
*/
Expand Down Expand Up @@ -481,6 +487,8 @@
return kFIRAuthErrorMessageNetworkError;
case FIRAuthErrorCodeKeychainError:
return kFIRAuthErrorMessageKeychainError;
case FIRAuthErrorCodeMissingClientIdentifier:
return kFIRAuthErrorMessageMissingClientIdentifier;
case FIRAuthErrorCodeUserTokenExpired:
return kFIRAuthErrorMessageUserTokenExpired;
case FIRAuthErrorCodeUserNotFound:
Expand Down Expand Up @@ -614,6 +622,8 @@
return @"ERROR_NETWORK_REQUEST_FAILED";
case FIRAuthErrorCodeKeychainError:
return @"ERROR_KEYCHAIN_ERROR";
case FIRAuthErrorCodeMissingClientIdentifier:
return @"ERROR_MISSING_CLIENT_IDENTIFIER";
case FIRAuthErrorCodeUserTokenExpired:
return @"ERROR_USER_TOKEN_EXPIRED";
case FIRAuthErrorCodeUserNotFound:
Expand Down Expand Up @@ -1086,6 +1096,10 @@ + (NSError *)appNotVerifiedErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeAppNotVerified message:message];
}

+ (NSError *)missingClientIdentifierErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeMissingClientIdentifier message:message];
}

+ (NSError *)captchaCheckFailedErrorWithMessage:(nullable NSString *)message {
return [self errorWithCode:FIRAuthInternalErrorCodeCaptchaCheckFailed message:message];
}
Expand Down
6 changes: 6 additions & 0 deletions Firebase/Auth/Source/Utilities/FIRAuthInternalErrors.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ typedef NS_ENUM(NSInteger, FIRAuthInternalErrorCode) {
FIRAuthInternalErrorCodeKeychainError =
FIRAuthPublicErrorCodeFlag | FIRAuthErrorCodeKeychainError,

/** @var FIRAuthInternalErrorCodeMissingClientIdentifier
@brief Indicates an error for when the client identifier is missing.
*/
FIRAuthInternalErrorCodeMissingClientIdentifier =
FIRAuthPublicErrorCodeFlag | FIRAuthErrorCodeMissingClientIdentifier,

/** @var FIRAuthInternalErrorCodeInternalError
@brief An internal error occurred.
@remarks This value is here for consistency. It's also used to make the implementation of
Expand Down