Skip to content

Commit cb56f88

Browse files
Support ERROR_INVALID_PROVIDER_ID in Firebase Auth.
1 parent 675e74a commit cb56f88

File tree

5 files changed

+42
-2
lines changed

5 files changed

+42
-2
lines changed

Firebase/Auth/Source/FIRAuthErrorUtils.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,12 @@ NS_ASSUME_NONNULL_BEGIN
522522
*/
523523
+ (NSError *)nullUserErrorWithMessage:(nullable NSString *)message;
524524

525+
/** @fn invalidProviderIDError
526+
@brief Constructs an @c NSError with the @c FIRAuthErrorCodeInvalidProviderID code.
527+
@remarks This error indicates that the provider id given for the web operation is invalid.
528+
*/
529+
+ (NSError *)invalidProviderIDError;
530+
525531
/** @fn invalidDynamicLinkDomainErrorWithMessage:
526532
@brief Constructs an @c NSError with the code and message provided.
527533
@param message Error message from the backend, if any.

Firebase/Auth/Source/FIRAuthErrorUtils.m

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,12 @@
424424
static NSString *const kFIRAuthErrorMessageNullUser = @"A null user object was provided as the "
425425
"argument for an operation which requires a non-null user object.";
426426

427+
/** @var kFIRAuthErrorMessageInvalidProviderID
428+
@brief Message for @c FIRAuthErrorCodeInvalidProviderID error code.
429+
*/
430+
static NSString *const kFIRAuthErrorMessageInvalidProviderID = @"The provider ID provided for the "
431+
"attempted web operation is invalid.";
432+
427433
/** @var kFIRAuthErrorMessageInvalidDynamicLinkDomain
428434
@brief Message for @c kFIRAuthErrorMessageInvalidDynamicLinkDomain error code.
429435
*/
@@ -559,6 +565,8 @@
559565
return kFIRAuthErrorMessageWebRequestFailed;
560566
case FIRAuthErrorCodeNullUser:
561567
return kFIRAuthErrorMessageNullUser;
568+
case FIRAuthErrorCodeInvalidProviderID:
569+
return kFIRAuthErrorMessageInvalidProviderID;
562570
case FIRAuthErrorCodeInvalidDynamicLinkDomain:
563571
return kFIRAuthErrorMessageInvalidDynamicLinkDomain;
564572
case FIRAuthErrorCodeWebInternalError:
@@ -690,6 +698,8 @@
690698
return @"ERROR_WEB_NETWORK_REQUEST_FAILED";
691699
case FIRAuthErrorCodeNullUser:
692700
return @"ERROR_NULL_USER";
701+
case FIRAuthErrorCodeInvalidProviderID:
702+
return @"ERROR_INVALID_PROVIDER_ID";
693703
case FIRAuthErrorCodeInvalidDynamicLinkDomain:
694704
return @"ERROR_INVALID_DYNAMIC_LINK_DOMAIN";
695705
case FIRAuthErrorCodeWebInternalError:
@@ -1136,6 +1146,10 @@ + (NSError *)nullUserErrorWithMessage:(nullable NSString *)message {
11361146
return [self errorWithCode:FIRAuthInternalErrorCodeNullUser message:message];
11371147
}
11381148

1149+
+ (NSError *)invalidProviderIDError {
1150+
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidProviderID];
1151+
}
1152+
11391153
+ (NSError *)invalidDynamicLinkDomainErrorWithMessage:(nullable NSString *)message {
11401154
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidDynamicLinkDomain message:message];
11411155
}

Firebase/Auth/Source/FIRAuthInternalErrors.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,11 @@ typedef NS_ENUM(NSInteger, FIRAuthInternalErrorCode) {
393393
FIRAuthInternalErrorCodeNullUser =
394394
FIRAuthPublicErrorCodeFlag | FIRAuthErrorCodeNullUser,
395395

396+
/** Indicates that the provider id given for the web operation is invalid.
397+
*/
398+
FIRAuthInternalErrorCodeInvalidProviderID =
399+
FIRAuthPublicErrorCodeFlag | FIRAuthErrorCodeInvalidProviderID,
400+
396401
/** Indicates that the Firebase Dynamic Link domain used is either not configured or is unauthorized
397402
for the current project.
398403
*/

Firebase/Auth/Source/Public/FIRAuthErrors.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,11 @@ typedef NS_ENUM(NSInteger, FIRAuthErrorCode) {
334334
*/
335335
FIRAuthErrorCodeNullUser = 17067,
336336

337+
/**
338+
* Represents the error code for when the given provider id for a web operation is invalid.
339+
*/
340+
FIRAuthErrorCodeInvalidProviderID = 17071,
341+
337342
/** Indicates that the Firebase Dynamic Link domain used is either not configured or is unauthorized
338343
for the current project.
339344
*/

Firebase/Auth/Source/RPCs/FIRAuthBackend.m

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,15 @@
294294
*/
295295
static NSString *const kUnauthorizedDomainErrorMessage = @"UNAUTHORIZED_DOMAIN";
296296

297+
/** @var kInvalidProviderIDErrorMessage
298+
@brief This is the error message the server will respond with if the provider id given for the
299+
web operation is invalid.
300+
*/
301+
static NSString *const kInvalidProviderIDErrorMessage = @"INVALID_PROVIDER_ID";
302+
297303
/** @var kInvalidDynamicLinkDomainErrorMessage
298-
@brief This is the error message the server will respond with if the dynamic link domain provided
299-
in the request is invalid.
304+
@brief This is the error message the server will respond with if the dynamic link domain
305+
provided in the request is invalid.
300306
*/
301307
static NSString *const kInvalidDynamicLinkDomainErrorMessage = @"INVALID_DYNAMIC_LINK_DOMAIN";
302308

@@ -1119,6 +1125,10 @@ + (nullable NSError *)clientErrorWithServerErrorMessage:(NSString *)serverErrorM
11191125
return [FIRAuthErrorUtils invalidContinueURIErrorWithMessage:serverDetailErrorMessage];
11201126
}
11211127

1128+
if ([shortErrorMessage isEqualToString:kInvalidProviderIDErrorMessage]) {
1129+
return [FIRAuthErrorUtils invalidProviderIDError];
1130+
}
1131+
11221132
if ([shortErrorMessage isEqualToString:kInvalidDynamicLinkDomainErrorMessage]) {
11231133
return [FIRAuthErrorUtils invalidDynamicLinkDomainErrorWithMessage:serverDetailErrorMessage];
11241134
}

0 commit comments

Comments
 (0)