Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit e2f89ee

Browse files
Login may fail if no providerdata is set
1 parent f923b84 commit e2f89ee

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/firebase.ios.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,15 +1107,17 @@ function toLoginResult(user) {
11071107
}
11081108

11091109
const providers = [];
1110-
for (let i = 0, l = user.providerData.count; i < l; i++) {
1111-
const firUserInfo = user.providerData.objectAtIndex(i);
1112-
const pid = firUserInfo.valueForKey("providerID");
1113-
// the app may have dropped Facebook support, so check if the native class is still there
1114-
if (pid === 'facebook.com' && typeof(FBSDKAccessToken) !== "undefined") { // FIRFacebookAuthProviderID
1115-
const fbCurrentAccessToken = FBSDKAccessToken.currentAccessToken();
1116-
providers.push({id: pid, token: fbCurrentAccessToken ? fbCurrentAccessToken.tokenString : null});
1117-
} else {
1118-
providers.push({id: pid});
1110+
if (user.providerData) {
1111+
for (let i = 0, l = user.providerData.count; i < l; i++) {
1112+
const firUserInfo = user.providerData.objectAtIndex(i);
1113+
const pid = firUserInfo.valueForKey("providerID");
1114+
// the app may have dropped Facebook support, so check if the native class is still there
1115+
if (pid === 'facebook.com' && typeof(FBSDKAccessToken) !== "undefined") { // FIRFacebookAuthProviderID
1116+
const fbCurrentAccessToken = FBSDKAccessToken.currentAccessToken();
1117+
providers.push({id: pid, token: fbCurrentAccessToken ? fbCurrentAccessToken.tokenString : null});
1118+
} else {
1119+
providers.push({id: pid});
1120+
}
11191121
}
11201122
}
11211123

0 commit comments

Comments
 (0)