Skip to content

Commit 69c85ab

Browse files
authored
fix error handling on v9 auth snippets (#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

snippets/auth-next/apple/auth_apple_signin_popup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ signInWithPopup(auth, provider)
2525
const errorCode = error.code;
2626
const errorMessage = error.message;
2727
// The email of the user's account used.
28-
const email = error.email;
28+
const email = error.customData.email;
2929
// The credential that was used.
3030
const credential = OAuthProvider.credentialFromError(error);
3131

snippets/auth-next/apple/auth_apple_signin_redirect_result.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ getRedirectResult(auth)
2525
const errorCode = error.code;
2626
const errorMessage = error.message;
2727
// The email of the user's account used.
28-
const email = error.email;
28+
const email = error.customData.email;
2929
// The credential that was used.
3030
const credential = OAuthProvider.credentialFromError(error);
3131

snippets/auth-next/facebook/auth_facebook_callback.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function checkLoginState(response) {
2626
const errorCode = error.code;
2727
const errorMessage = error.message;
2828
// The email of the user's account used.
29-
const email = error.email;
29+
const email = error.customData.email;
3030
// The AuthCredential type that was used.
3131
const credential = FacebookAuthProvider.credentialFromError(error);
3232
// ...

snippets/auth-next/facebook/auth_facebook_signin_credential.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ signInWithCredential(auth, credential)
1919
const errorCode = error.code;
2020
const errorMessage = error.message;
2121
// The email of the user's account used.
22-
const email = error.email;
22+
const email = error.customData.email;
2323
// The AuthCredential type that was used.
2424
const credential = FacebookAuthProvider.credentialFromError(error);
2525
// ...

snippets/auth-next/facebook/auth_facebook_signin_popup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ signInWithPopup(auth, 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 = FacebookAuthProvider.credentialFromError(error);
3030

snippets/auth-next/facebook/auth_facebook_signin_redirect_result.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ getRedirectResult(auth)
2020
const errorCode = error.code;
2121
const errorMessage = error.message;
2222
// The email of the user's account used.
23-
const email = error.email;
23+
const email = error.customData.email;
2424
// AuthCredential type that was used.
2525
const credential = FacebookAuthProvider.credentialFromError(error);
2626
// ...

snippets/auth-next/github/auth_github_signin_popup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ signInWithPopup(auth, provider)
2222
const errorCode = error.code;
2323
const errorMessage = error.message;
2424
// The email of the user's account used.
25-
const email = error.email;
25+
const email = error.customData.email;
2626
// The AuthCredential type that was used.
2727
const credential = GithubAuthProvider.credentialFromError(error);
2828
// ...

snippets/auth-next/github/auth_github_signin_redirect_result.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ getRedirectResult(auth)
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 = GithubAuthProvider.credentialFromError(error);
3030
// ...

snippets/auth-next/google-signin/auth_google_build_signin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ signInWithCredential(auth, credential).catch((error) => {
1717
const errorCode = error.code;
1818
const errorMessage = error.message;
1919
// The email of the user's account used.
20-
const email = error.email;
20+
const email = error.customData.email;
2121
// The AuthCredential type that was used.
2222
const credential = GoogleAuthProvider.credentialFromError(error);
2323
// ...

snippets/auth-next/google-signin/auth_google_callback.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function onSignIn(googleUser) {
2525
const errorCode = error.code;
2626
const errorMessage = error.message;
2727
// The email of the user's account used.
28-
const email = error.email;
28+
const email = error.customData.email;
2929
// The credential that was used.
3030
const credential = GoogleAuthProvider.credentialFromError(error);
3131
// ...

snippets/auth-next/google-signin/auth_google_signin_credential.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ signInWithCredential(auth, credential).catch((error) => {
1010
const errorCode = error.code;
1111
const errorMessage = error.message;
1212
// The email of the user's account used.
13-
const email = error.email;
13+
const email = error.customData.email;
1414
// The credential that was used.
1515
const credential = GoogleAuthProvider.credentialFromError(error);
1616
// ...

snippets/auth-next/google-signin/auth_google_signin_popup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ signInWithPopup(auth, provider)
2121
const errorCode = error.code;
2222
const errorMessage = error.message;
2323
// The email of the user's account used.
24-
const email = error.email;
24+
const email = error.customData.email;
2525
// The AuthCredential type that was used.
2626
const credential = GoogleAuthProvider.credentialFromError(error);
2727
// ...

snippets/auth-next/google-signin/auth_google_signin_redirect_result.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ getRedirectResult(auth)
2121
const errorCode = error.code;
2222
const errorMessage = error.message;
2323
// The email of the user's account used.
24-
const email = error.email;
24+
const email = error.customData.email;
2525
// The AuthCredential type that was used.
2626
const credential = GoogleAuthProvider.credentialFromError(error);
2727
// ...

snippets/auth-next/index/auth_signin_credential.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ signInWithCredential(auth, credential)
1919
const errorCode = error.code;
2020
const errorMessage = error.message;
2121
// The email of the user's account used.
22-
const email = error.email;
22+
const email = error.customData.email;
2323
// ...
2424
});
2525
// [END auth_signin_credential_modular]

snippets/auth-next/multi-tenancy/multitenant_account_exists_popup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ signInWithPopup(auth, samlProvider)
1919
const pendingCred = error.credential;
2020
// The credential's tenantId if needed: error.tenantId
2121
// The provider account's email address.
22-
const email = error.email;
22+
const email = error.customData.email;
2323
// Get sign-in methods for this email.
2424
fetchSignInMethodsForEmail(email, auth)
2525
.then((methods) => {

snippets/auth-next/multi-tenancy/multitenant_account_exists_redirect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ getRedirectResult(auth).catch((error) => {
2020
// The pending SAML credential.
2121
pendingCred = error.credential;
2222
// The provider account's email address.
23-
const email = error.email;
23+
const email = error.customData.email;
2424
// Need to set the tenant ID again as the page was reloaded and the
2525
// previous setting was reset.
2626
auth.tenantId = tenantId;

snippets/auth-next/oidc/auth_oidc_direct_sign_in.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ signInWithCredential(auth, credential)
2222
const errorCode = error.code;
2323
const errorMessage = error.message;
2424
// The email of the user's account used.
25-
const email = error.email;
25+
const email = error.customData.email;
2626
// The AuthCredential type that was used.
2727
const credential = OAuthProvider.credentialFromError(error);
2828
// Handle / display error.

snippets/auth-next/oidc/auth_oidc_signin_popup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ signInWithPopup(auth, provider)
1818
const errorCode = error.code;
1919
const errorMessage = error.message;
2020
// The email of the user's account used.
21-
const email = error.email;
21+
const email = error.customData.email;
2222
// The AuthCredential type that was used.
2323
const credential = OAuthProvider.credentialFromError(error);
2424
// Handle / display error.

snippets/auth-next/oidc/auth_oidc_signin_redirect_result.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ getRedirectResult(auth)
1919
const errorCode = error.code;
2020
const errorMessage = error.message;
2121
// The email of the user's account used.
22-
const email = error.email;
22+
const email = error.customData.email;
2323
// The AuthCredential type that was used.
2424
const credential = OAuthProvider.credentialFromError(error);
2525
// Handle / display error.

snippets/auth-next/saml/auth_saml_signin_popup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ signInWithPopup(auth, provider)
1818
const errorCode = error.code;
1919
const errorMessage = error.message;
2020
// The email of the user's account used.
21-
const email = error.email;
21+
const email = error.customData.email;
2222
// The AuthCredential type that was used.
2323
const credential = SAMLAuthProvider.credentialFromError(error);
2424
// Handle / display error.

0 commit comments

Comments
 (0)