Skip to content

Commit 68ebc06

Browse files
author
Nicolas Garnier
committed
Used variable instead of String for IDP ProviderID
Change-Id: I162be2129d2b786a13febe21c93fcdc9ef023ca5 Bug: 28795494
1 parent 9cd488b commit 68ebc06

13 files changed

+17
-17
lines changed

auth/anon.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
var errorCode = error.code;
5050
var errorMessage = error.message;
5151
// [START_EXCLUDE]
52-
if (errorCode == 'auth/operation-not-allowed') {
52+
if (errorCode === 'auth/operation-not-allowed') {
5353
alert('You must enable Anonymous auth in the Firebase Console.');
5454
} else {
5555
console.error(error);

auth/customauth.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
var errorCode = error.code;
5656
var errorMessage = error.message;
5757
// [START_EXCLUDE]
58-
if (errorCode == 'auth/invalid-custom-token') {
58+
if (errorCode === 'auth/invalid-custom-token') {
5959
alert('The token you provided is not valid.');
6060
} else {
6161
console.error(error);

auth/email.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
var errorCode = error.code;
6161
var errorMessage = error.message;
6262
// [START_EXCLUDE]
63-
if (errorCode == 'auth/wrong-password') {
63+
if (errorCode === 'auth/wrong-password') {
6464
alert('Wrong password.');
6565
} else {
6666
console.error(error);

auth/facebook-credentials.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
// The firebase.auth.AuthCredential type that was used.
8383
var credential = error.credential;
8484
// [START_EXCLUDE]
85-
if (errorCode == 'auth/account-exists-with-different-credential') {
85+
if (errorCode === 'auth/account-exists-with-different-credential') {
8686
alert('You have already signed up with a different auth provider for that email.');
8787
// If you are using multiple auth providers on your app you should handle linking
8888
// the user's accounts here.
@@ -113,8 +113,8 @@
113113
if (firebaseUser) {
114114
var providerData = firebaseUser.providerData;
115115
for (var i = 0; i < providerData.length; i++) {
116-
if (providerData[i].providerId === 'facebook.com' &&
117-
providerData[i].uid == facebookAuthResponse.userID) {
116+
if (providerData[i].providerId === firebase.auth.FacebookAuthProvider.PROVIDER_ID &&
117+
providerData[i].uid === facebookAuthResponse.userID) {
118118
// We don't need to re-auth the Firebase connection.
119119
return true;
120120
}

auth/facebook-popup.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
// The firebase.auth.AuthCredential type that was used.
6565
var credential = error.credential;
6666
// [START_EXCLUDE]
67-
if (errorCode == 'auth/account-exists-with-different-credential') {
67+
if (errorCode === 'auth/account-exists-with-different-credential') {
6868
alert('You have already signed up with a different auth provider for that email.');
6969
// If you are using multiple auth providers on your app you should handle linking
7070
// the user's accounts here.

auth/facebook-redirect.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
// The firebase.auth.AuthCredential type that was used.
9999
var credential = error.credential;
100100
// [START_EXCLUDE]
101-
if (errorCode == 'auth/account-exists-with-different-credential') {
101+
if (errorCode === 'auth/account-exists-with-different-credential') {
102102
alert('You have already signed up with a different auth provider for that email.');
103103
// If you are using multiple auth providers on your app you should handle linking
104104
// the user's accounts here.

auth/github-popup.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
// The firebase.auth.AuthCredential type that was used.
6565
var credential = error.credential;
6666
// [START_EXCLUDE]
67-
if (errorCode == 'auth/account-exists-with-different-credential') {
67+
if (errorCode === 'auth/account-exists-with-different-credential') {
6868
alert('You have already signed up with a different auth provider for that email.');
6969
// If you are using multiple auth providers on your app you should handle linking
7070
// the user's accounts here.

auth/github-redirect.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
// The firebase.auth.AuthCredential type that was used.
9999
var credential = error.credential;
100100
// [START_EXCLUDE]
101-
if (errorCode == 'auth/account-exists-with-different-credential') {
101+
if (errorCode === 'auth/account-exists-with-different-credential') {
102102
alert('You have already signed up with a different auth provider for that email.');
103103
// If you are using multiple auth providers on your app you should handle linking
104104
// the user's accounts here.

auth/google-credentials.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
// The firebase.auth.AuthCredential type that was used.
8080
var credential = error.credential;
8181
// [START_EXCLUDE]
82-
if (errorCode == 'auth/account-exists-with-different-credential') {
82+
if (errorCode === 'auth/account-exists-with-different-credential') {
8383
alert('You have already signed up with a different auth provider for that email.');
8484
// If you are using multiple auth providers on your app you should handle linking
8585
// the user's accounts here.
@@ -104,8 +104,8 @@
104104
if (firebaseUser) {
105105
var providerData = firebaseUser.providerData;
106106
for (var i = 0; i < providerData.length; i++) {
107-
if (providerData[i].providerId === 'google.com' &&
108-
providerData[i].uid == googleUser.getBasicProfile().getId()) {
107+
if (providerData[i].providerId === firebase.auth.GoogleAuthProvider.PROVIDER_ID &&
108+
providerData[i].uid === googleUser.getBasicProfile().getId()) {
109109
// We don't need to reauth the Firebase connection.
110110
return true;
111111
}

auth/google-popup.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
// The firebase.auth.AuthCredential type that was used.
6565
var credential = error.credential;
6666
// [START_EXCLUDE]
67-
if (errorCode == 'auth/account-exists-with-different-credential') {
67+
if (errorCode === 'auth/account-exists-with-different-credential') {
6868
alert('You have already signed up with a different auth provider for that email.');
6969
// If you are using multiple auth providers on your app you should handle linking
7070
// the user's accounts here.

auth/google-redirect.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
// The firebase.auth.AuthCredential type that was used.
9999
var credential = error.credential;
100100
// [START_EXCLUDE]
101-
if (errorCode == 'auth/account-exists-with-different-credential') {
101+
if (errorCode === 'auth/account-exists-with-different-credential') {
102102
alert('You have already signed up with a different auth provider for that email.');
103103
// If you are using multiple auth providers on your app you should handle linking
104104
// the user's accounts here.

auth/twitter-popup.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
// The firebase.auth.AuthCredential type that was used.
6565
var credential = error.credential;
6666
// [START_EXCLUDE]
67-
if (errorCode == 'auth/account-exists-with-different-credential') {
67+
if (errorCode === 'auth/account-exists-with-different-credential') {
6868
alert('You have already signed up with a different auth provider for that email.');
6969
// If you are using multiple auth providers on your app you should handle linking
7070
// the user's accounts here.

auth/twitter-redirect.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
// The firebase.auth.AuthCredential type that was used.
100100
var credential = error.credential;
101101
// [START_EXCLUDE]
102-
if (errorCode == 'auth/account-exists-with-different-credential') {
102+
if (errorCode === 'auth/account-exists-with-different-credential') {
103103
alert('You have already signed up with a different auth provider for that email.');
104104
// If you are using multiple auth providers on your app you should handle linking
105105
// the user's accounts here.

0 commit comments

Comments
 (0)