Skip to content

Commit 91770e3

Browse files
authored
Make sure the first valid auth domain is retrieved (#3493)
1 parent 13a1b33 commit 91770e3

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

Example/Auth/Sample/MainViewController+OAuth.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@ - (StaticContentTableViewSection *)oAuthSection {
2929
return [StaticContentTableViewSection sectionWithTitle:@"OAuth" cells:@[
3030
[StaticContentTableViewCell cellWithTitle:@"Sign in with Google"
3131
action:^{ [weakSelf signInGoogleHeadfulLite]; }],
32-
[StaticContentTableViewCell cellWithTitle:@"Sign In with Twitter (headful-lite)"
32+
[StaticContentTableViewCell cellWithTitle:@"Sign in with Twitter"
3333
action:^{ [weakSelf signInTwitterHeadfulLite]; }],
34-
[StaticContentTableViewCell cellWithTitle:@"Sign In with Linkedin"
35-
action:^{ [weakSelf signInLinkedinHeadfulLite]; }],
36-
[StaticContentTableViewCell cellWithTitle:@"Sign In with GitHub (access token)"
37-
action:^{ [weakSelf signInWithGitHub]; }],
38-
[StaticContentTableViewCell cellWithTitle:@"Sign In with GitHub (headful-lite)"
34+
[StaticContentTableViewCell cellWithTitle:@"Sign in with GitHub"
3935
action:^{ [weakSelf signInGitHubHeadfulLite]; }],
36+
[StaticContentTableViewCell cellWithTitle:@"Sign in with GitHub (Access token)"
37+
action:^{ [weakSelf signInWithGitHub]; }],
4038
[StaticContentTableViewCell cellWithTitle:@"Sign in with Microsoft"
4139
action:^{ [weakSelf signInMicrosoftHeadfulLite]; }],
42-
[StaticContentTableViewCell cellWithTitle:@"Sign In with Yahoo"
40+
[StaticContentTableViewCell cellWithTitle:@"Sign in with Yahoo"
4341
action:^{ [weakSelf signInYahooHeadfulLite]; }],
42+
[StaticContentTableViewCell cellWithTitle:@"Sign in with Linkedin"
43+
action:^{ [weakSelf signInLinkedinHeadfulLite]; }],
4444
]];
4545
}
4646

Firebase/Auth/Source/Utilities/FIRAuthWebUtils.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ + (void)fetchAuthDomainWithRequestConfiguration:(FIRAuthRequestConfiguration *)r
9696
completion(nil, error);
9797
return;
9898
}
99+
// Look up an authorized domain ends with one of the supportedAuthDomains.
100+
// The sequence of supportedAuthDomains matters. ("firebaseapp.com", "web.app")
101+
// The searching ends once the first valid suportedAuthDomain is found.
99102
NSString *authDomain;
100103
for (NSString *domain in response.authorizedDomains) {
101104
for (NSString *suportedAuthDomain in [self supportedAuthDomains]) {
@@ -107,6 +110,9 @@ + (void)fetchAuthDomainWithRequestConfiguration:(FIRAuthRequestConfiguration *)r
107110
}
108111
}
109112
}
113+
if (authDomain != nil) {
114+
break;
115+
}
110116
}
111117
if (!authDomain.length) {
112118
completion(nil, [FIRAuthErrorUtils unexpectedErrorResponseWithDeserializedResponse:response]);

0 commit comments

Comments
 (0)