Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ typedef void (^FIRVerifyClientCallback)(FIRAuthAppCredential *_Nullable appCrede
*/
typedef void (^FIRFetchAuthDomainCallback)(NSString *_Nullable authDomain,
NSError *_Nullable error);
/** @var kAuthDomainSuffix
@brief The suffix of the auth domain pertiaining to a given Firebase project.
*/
static NSString *const kAuthDomainSuffix = @"firebaseapp.com";

/** @var kauthTypeVerifyApp
@brief The auth type to be specified in the app verification request.
Expand Down
21 changes: 11 additions & 10 deletions Firebase/Auth/Source/Utilities/FIRAuthWebUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@

NS_ASSUME_NONNULL_BEGIN

/** @var kAuthDomainSuffix
@brief The suffix of the auth domain pertiaining to a given Firebase project.
*/
static NSString *const kAuthDomainSuffix = @"firebaseapp.com";

@implementation FIRAuthWebUtils

+ (NSArray<NSString *> *)supportedAuthDomains {
return @[@"firebaseapp.com", @"web.app"];
}

+ (NSString *)randomStringWithLength:(NSUInteger)length {
NSMutableString *randomString = [[NSMutableString alloc] init];
for (int i=0; i < length; i++) {
Expand Down Expand Up @@ -99,11 +98,13 @@ + (void)fetchAuthDomainWithRequestConfiguration:(FIRAuthRequestConfiguration *)r
}
NSString *authDomain;
for (NSString *domain in response.authorizedDomains) {
NSInteger index = domain.length - kAuthDomainSuffix.length;
if (index >= 2) {
if ([domain hasSuffix:kAuthDomainSuffix] && domain.length >= kAuthDomainSuffix.length + 2) {
authDomain = domain;
break;
for (NSString *suportedAuthDomain in [self supportedAuthDomains]) {
NSInteger index = domain.length - suportedAuthDomain.length;
if (index >= 2) {
if ([domain hasSuffix:suportedAuthDomain] && domain.length >= suportedAuthDomain.length + 2) {
authDomain = domain;
break;
}
}
}
}
Expand Down