Skip to content

Commit 69c85ab

Browse files
authored
fix error handling on v9 auth snippets (firebase#289)
1 parent 9bdf357 commit 69c85ab

33 files changed

+47
-47
lines changed

auth-next/apple.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function appleSignInPopup(provider) {
4545
const errorCode = error.code;
4646
const errorMessage = error.message;
4747
// The email of the user's account used.
48-
const email = error.email;
48+
const email = error.customData.email;
4949
// The credential that was used.
5050
const credential = OAuthProvider.credentialFromError(error);
5151

@@ -85,7 +85,7 @@ function appleSignInRedirectResult() {
8585
const errorCode = error.code;
8686
const errorMessage = error.message;
8787
// The email of the user's account used.
88-
const email = error.email;
88+
const email = error.customData.email;
8989
// The credential that was used.
9090
const credential = OAuthProvider.credentialFromError(error);
9191

@@ -123,7 +123,7 @@ function appleReauthenticatePopup() {
123123
const errorCode = error.code;
124124
const errorMessage = error.message;
125125
// The email of the user's account used.
126-
const email = error.email;
126+
const email = error.customData.email;
127127
// The credential that was used.
128128
const credential = OAuthProvider.credentialFromError(error);
129129

auth-next/facebook.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function facebookSignInPopup(provider) {
4040
const errorCode = error.code;
4141
const errorMessage = error.message;
4242
// The email of the user's account used.
43-
const email = error.email;
43+
const email = error.customData.email;
4444
// The AuthCredential type that was used.
4545
const credential = FacebookAuthProvider.credentialFromError(error);
4646

@@ -66,7 +66,7 @@ function facebookSignInRedirectResult() {
6666
const errorCode = error.code;
6767
const errorMessage = error.message;
6868
// The email of the user's account used.
69-
const email = error.email;
69+
const email = error.customData.email;
7070
// AuthCredential type that was used.
7171
const credential = FacebookAuthProvider.credentialFromError(error);
7272
// ...
@@ -102,7 +102,7 @@ function checkLoginState_wrapper() {
102102
const errorCode = error.code;
103103
const errorMessage = error.message;
104104
// The email of the user's account used.
105-
const email = error.email;
105+
const email = error.customData.email;
106106
// The AuthCredential type that was used.
107107
const credential = FacebookAuthProvider.credentialFromError(error);
108108
// ...
@@ -156,7 +156,7 @@ function authWithCredential(credential) {
156156
const errorCode = error.code;
157157
const errorMessage = error.message;
158158
// The email of the user's account used.
159-
const email = error.email;
159+
const email = error.customData.email;
160160
// The AuthCredential type that was used.
161161
const credential = FacebookAuthProvider.credentialFromError(error);
162162
// ...

auth-next/github.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function githubSignInPopup(provider) {
4646
const errorCode = error.code;
4747
const errorMessage = error.message;
4848
// The email of the user's account used.
49-
const email = error.email;
49+
const email = error.customData.email;
5050
// The AuthCredential type that was used.
5151
const credential = GithubAuthProvider.credentialFromError(error);
5252
// ...
@@ -75,7 +75,7 @@ function githubSignInRedirectResult() {
7575
const errorCode = error.code;
7676
const errorMessage = error.message;
7777
// The email of the user's account used.
78-
const email = error.email;
78+
const email = error.customData.email;
7979
// The AuthCredential type that was used.
8080
const credential = GithubAuthProvider.credentialFromError(error);
8181
// ...

auth-next/google-signin.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function googleSignInPopup(provider) {
3939
const errorCode = error.code;
4040
const errorMessage = error.message;
4141
// The email of the user's account used.
42-
const email = error.email;
42+
const email = error.customData.email;
4343
// The AuthCredential type that was used.
4444
const credential = GoogleAuthProvider.credentialFromError(error);
4545
// ...
@@ -65,7 +65,7 @@ function googleSignInRedirectResult() {
6565
const errorCode = error.code;
6666
const errorMessage = error.message;
6767
// The email of the user's account used.
68-
const email = error.email;
68+
const email = error.customData.email;
6969
// The AuthCredential type that was used.
7070
const credential = GoogleAuthProvider.credentialFromError(error);
7171
// ...
@@ -87,7 +87,7 @@ function googleBuildAndSignIn(id_token) {
8787
const errorCode = error.code;
8888
const errorMessage = error.message;
8989
// The email of the user's account used.
90-
const email = error.email;
90+
const email = error.customData.email;
9191
// The AuthCredential type that was used.
9292
const credential = GoogleAuthProvider.credentialFromError(error);
9393
// ...
@@ -123,7 +123,7 @@ function onSignIn_wrapper() {
123123
const errorCode = error.code;
124124
const errorMessage = error.message;
125125
// The email of the user's account used.
126-
const email = error.email;
126+
const email = error.customData.email;
127127
// The credential that was used.
128128
const credential = GoogleAuthProvider.credentialFromError(error);
129129
// ...

auth-next/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function authWithCredential(credential) {
107107
const errorCode = error.code;
108108
const errorMessage = error.message;
109109
// The email of the user's account used.
110-
const email = error.email;
110+
const email = error.customData.email;
111111
// ...
112112
});
113113
// [END auth_signin_credential]

auth-next/multi-tenancy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ function accountExistsPopupTenant(auth, samlProvider, googleProvider, goToApp) {
273273
const pendingCred = error.credential;
274274
// The credential's tenantId if needed: error.tenantId
275275
// The provider account's email address.
276-
const email = error.email;
276+
const email = error.customData.email;
277277
// Get sign-in methods for this email.
278278
fetchSignInMethodsForEmail(email, auth)
279279
.then((methods) => {
@@ -315,7 +315,7 @@ function accountExistsRedirectTenant(auth, samlProvider, googleProvider, goToApp
315315
// The pending SAML credential.
316316
pendingCred = error.credential;
317317
// The provider account's email address.
318-
const email = error.email;
318+
const email = error.customData.email;
319319
// Need to set the tenant ID again as the page was reloaded and the
320320
// previous setting was reset.
321321
auth.tenantId = tenantId;

auth-next/oidc.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function oidcSignInPopup(provider) {
2424
const errorCode = error.code;
2525
const errorMessage = error.message;
2626
// The email of the user's account used.
27-
const email = error.email;
27+
const email = error.customData.email;
2828
// The AuthCredential type that was used.
2929
const credential = OAuthProvider.credentialFromError(error);
3030
// Handle / display error.
@@ -58,7 +58,7 @@ function oidcSignInRedirectResult(provider) {
5858
const errorCode = error.code;
5959
const errorMessage = error.message;
6060
// The email of the user's account used.
61-
const email = error.email;
61+
const email = error.customData.email;
6262
// The AuthCredential type that was used.
6363
const credential = OAuthProvider.credentialFromError(error);
6464
// Handle / display error.
@@ -86,7 +86,7 @@ function oidcDirectSignIn(provider, oidcIdToken) {
8686
const errorCode = error.code;
8787
const errorMessage = error.message;
8888
// The email of the user's account used.
89-
const email = error.email;
89+
const email = error.customData.email;
9090
// The AuthCredential type that was used.
9191
const credential = OAuthProvider.credentialFromError(error);
9292
// Handle / display error.

auth-next/saml.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function samlSignInPopup(provider) {
2424
const errorCode = error.code;
2525
const errorMessage = error.message;
2626
// The email of the user's account used.
27-
const email = error.email;
27+
const email = error.customData.email;
2828
// The AuthCredential type that was used.
2929
const credential = SAMLAuthProvider.credentialFromError(error);
3030
// Handle / display error.
@@ -58,7 +58,7 @@ function samlSignInRedirectResult(provider) {
5858
const errorCode = error.code;
5959
const errorMessage = error.message;
6060
// The email of the user's account used.
61-
const email = error.email;
61+
const email = error.customData.email;
6262
// The AuthCredential type that was used.
6363
const credential = SAMLAuthProvider.credentialFromError(error);
6464
// Handle / display error.

auth-next/twitter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function twitterSignInPopup(provider) {
3636
const errorCode = error.code;
3737
const errorMessage = error.message;
3838
// The email of the user's account used.
39-
const email = error.email;
39+
const email = error.customData.email;
4040
// The AuthCredential type that was used.
4141
const credential = TwitterAuthProvider.credentialFromError(error);
4242
// ...
@@ -65,7 +65,7 @@ function twitterSignInRedirectResult() {
6565
const errorCode = error.code;
6666
const errorMessage = error.message;
6767
// The email of the user's account used.
68-
const email = error.email;
68+
const email = error.customData.email;
6969
// The AuthCredential type that was used.
7070
const credential = TwitterAuthProvider.credentialFromError(error);
7171
// ...

snippets/auth-next/apple/auth_apple_reauthenticate_popup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ reauthenticateWithPopup(auth.currentUser, provider)
3232
const errorCode = error.code;
3333
const errorMessage = error.message;
3434
// The email of the user's account used.
35-
const email = error.email;
35+
const email = error.customData.email;
3636
// The credential that was used.
3737
const credential = OAuthProvider.credentialFromError(error);
3838

0 commit comments

Comments
 (0)