Skip to content

Commit c9c0dee

Browse files
committed
Added comments pointing to issue numbers in getLoginMethodAndParams
1 parent 03f53fa commit c9c0dee

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/utils/auth.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ export const getLoginMethodAndParams = (firebase, creds) => {
7777
applicationVerifier,
7878
credential
7979
} = creds
80+
// Credential Auth
8081
if (credential) {
82+
// Attempt to use signInAndRetrieveDataWithCredential if it exists (see #467 for more info)
8183
const credentialAuth = firebase.auth().signInAndRetrieveDataWithCredential
8284

8385
if (credentialAuth) {
@@ -88,6 +90,8 @@ export const getLoginMethodAndParams = (firebase, creds) => {
8890
}
8991
return { method: 'signInWithCredential', params: [credential] }
9092
}
93+
94+
// Provider Auth
9195
if (provider) {
9296
// Verify providerName is valid
9397
if (supportedAuthProviders.indexOf(provider.toLowerCase()) === -1) {
@@ -104,7 +108,10 @@ export const getLoginMethodAndParams = (firebase, creds) => {
104108
}
105109
return { method: 'signInWithRedirect', params: [authProvider] }
106110
}
111+
112+
// Token Auth
107113
if (token) {
114+
// Check for new sign in method (see #484 for more info)
108115
const tokenAuth = firebase.auth().signInAndRetrieveDataWithCustomToken
109116

110117
if (tokenAuth) {
@@ -113,6 +120,8 @@ export const getLoginMethodAndParams = (firebase, creds) => {
113120

114121
return { method: 'signInWithCustomToken', params: [token] }
115122
}
123+
124+
// Phone Number Auth
116125
if (phoneNumber) {
117126
if (!applicationVerifier) {
118127
throw new Error(
@@ -125,9 +134,10 @@ export const getLoginMethodAndParams = (firebase, creds) => {
125134
}
126135
}
127136

137+
// Email/Password Auth
138+
// Check for new sign in method (see #484 for more info)
128139
const emailPasswordAuth = firebase.auth()
129140
.signInAndRetrieveDataWithEmailAndPassword
130-
131141
if (emailPasswordAuth) {
132142
return {
133143
method: 'signInAndRetrieveDataWithEmailAndPassword',

0 commit comments

Comments
 (0)